Update automapper
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using Heroic.AutoMapper;
|
||||
using InventoryTraker.Web.Core;
|
||||
|
||||
namespace InventoryTraker.Web.Models
|
||||
{
|
||||
public class ProfileForm : IMapFrom<User>, IHaveCustomMappings
|
||||
public class ProfileForm
|
||||
{
|
||||
[Required, Display(Name = "Full Name", Prompt = "Full Name (ex: John Doe)...")]
|
||||
public string FullName { get; set; }
|
||||
@@ -13,11 +12,14 @@ namespace InventoryTraker.Web.Models
|
||||
[Required, DataType(DataType.EmailAddress), Display(Prompt = "your@email.com...")]
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
public void CreateMappings(IMapperConfiguration configuration)
|
||||
public class AutoMapperProfile : Profile
|
||||
{
|
||||
configuration.CreateMap<User, ProfileForm>()
|
||||
.ForMember(d => d.FullName, opt => opt.MapFrom(s => s.UserName))
|
||||
.ForMember(d => d.EmailAddress, opt => opt.MapFrom(s => s.Email));
|
||||
public AutoMapperProfile()
|
||||
{
|
||||
CreateMap<User, ProfileForm>()
|
||||
.ForMember(d => d.FullName, opt => opt.MapFrom(s => s.UserName))
|
||||
.ForMember(d => d.EmailAddress, opt => opt.MapFrom(s => s.Email));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user