This article has not yet been verified against Umbraco 8.

    The concepts and code examples might not work if you are running Umbraco 8.0 or a later version. If you are using Umbraco 7, this article is perfect for you!

    You are more than welcome to report any issues found on the Documentation Issue Tracker.

    MemberTypeService

    Applies to Umbraco 6.2 and 7.1 and newer

    The MemberTypeService acts as a "gateway" to Umbraco data for operations which are related to MemberTypes.

    Browse the API documentation for MemberTypeService.

    • Namespace: Umbraco.Core.Services
    • Assembly: Umbraco.Core.dll

    All samples in this document will require references to the following dll:

    • Umbraco.Core.dll

    All samples in this document will require the following using statements:

    using Umbraco.Core;
    using Umbraco.Core.Models;
    using Umbraco.Core.Services;
    

    Getting the service

    The MemberTypeService is available through the ApplicationContext, but the if you are using a SurfaceController or the UmbracoUserControl then the MemberTypeService is available through a local Services property.

    Services.MemberTypeService
    

    Getting the service through the ApplicationContext:

    ApplicationContext.Current.Services.MemberTypeService
    

    Methods

    .Delete(IMemberType memberType);

    Deletes a MemberType

    .Get(string alias)

    Returns a MemberType with a given alias

    .GetAll(int[] ids);

    Returns a collection of MemberType with the given ids

    .Save(IMemberType memberType)

    Saves a MemberType