Files
Umbraco-CMS/src/Umbraco.Web.Website/Models/MemberModelBuilderFactory.cs
Nikolaj Geisle 4f3d680f06 V10: Build warnings in Web.Website (#12332)
* add new rule to globalconfig

* Fix warnings in Web.Website

* Fix more warnings in Web.Website

* Fix more build warnings in Web.Website

* Fix more warnings in Web.Website

* Fix tests

* Fix proper constructor call

* Fix not being able to run project

* Fix Obsolete method

Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk>
2022-05-06 15:06:39 +02:00

42 lines
1.4 KiB
C#

using Microsoft.AspNetCore.Http;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
namespace Umbraco.Cms.Web.Website.Models;
/// <summary>
/// Service to create model builder instances for working with Members on the front-end
/// </summary>
public class MemberModelBuilderFactory
{
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IMemberService _memberService;
private readonly IMemberTypeService _memberTypeService;
private readonly IShortStringHelper _shortStringHelper;
public MemberModelBuilderFactory(
IMemberTypeService memberTypeService,
IMemberService memberService,
IShortStringHelper shortStringHelper,
IHttpContextAccessor httpContextAccessor)
{
_memberTypeService = memberTypeService;
_memberService = memberService;
_shortStringHelper = shortStringHelper;
_httpContextAccessor = httpContextAccessor;
}
/// <summary>
/// Create a <see cref="RegisterModelBuilder" />
/// </summary>
/// <returns></returns>
public RegisterModelBuilder CreateRegisterModel() => new(_memberTypeService, _shortStringHelper);
/// <summary>
/// Create a <see cref="RegisterModelBuilder" />
/// </summary>
/// <returns></returns>
public ProfileModelBuilder CreateProfileModel() =>
new(_memberTypeService, _memberService, _shortStringHelper, _httpContextAccessor);
}