예제 #1
0
 private UserModel ToUserModel(Entities.Identity.User user)
 {
     return(new UserModel
     {
         Id = user.Id,
         Email = user.Email,
         FirstName = user.FirstName,
         LastName = user.LastName,
         DisplayName = user.DisplayName,
         PhoneNumber = user.PhoneNumber,
         ProfilePicture = user.ProfilePicture,
         UserStatus = user.UserStatus,
         CompanyId = user.CompanyId,
         UserName = user.UserName,
         City = user.City,
         Country = user.Country,
         State = user.State,
         ZipCode = user.ZipCode,
         StreetAddress = user.StreetAddress,
         JobTitle = user.JobTitle,
         AlternativeEmail = user.AlternativeEmail,
         CompanyName = user.CompanyName,
         Roles = user.Roles.Select(x => new RoleModel
         {
             Id = x.Role.Id,
             Name = x.Role.Name,
             FriendlyName = x.Role.FriendlyName
         })
     });
 }
예제 #2
0
        private void ModelToEntity(UserModel model, Entities.Identity.User user)
        {
            user.FirstName        = model.FirstName;
            user.LastName         = model.LastName;
            user.DisplayName      = model.DisplayName;
            user.CompanyName      = model.CompanyName;
            user.JobTitle         = model.JobTitle;
            user.AlternativeEmail = model.AlternativeEmail;
            user.Country          = model.Country;
            user.State            = model.State;
            user.ZipCode          = model.ZipCode;
            user.StreetAddress    = model.StreetAddress;
            user.PhoneNumber      = model.PhoneNumber;
            user.City             = model.City;
            user.UserStatus       = model.UserStatus;
            if (!string.IsNullOrWhiteSpace(model.ProfilePicture))
            {
                user.ProfilePicture = model.ProfilePicture;
            }

            user.SecurityStamp = Guid.NewGuid().ToString();
        }