public static UserModel MapAspNetUserToUserModel(AspNetUser user) { var userModel = new UserModel { Id = user.Id, FName = user.FirstName, LName = user.LastName, Email = user.Email, EmailConfirmed = user.EmailConfirmed, AccessFailedCount = user.AccessFailedCount, Active = user.Enabled, Birthday = user.Birthday, DateCreated = user.DateCreated, HashOfPassword = user.PasswordHash, LockoutEndDateUtc = user.LockoutEndDateUtc, PhoneNr = user.PhoneNumber, Username = user.UserName, SecurityStamp = user.SecurityStamp, TwoFactorEnabled = user.TwoFactorEnabled, AnonymousRequest = MapAnonymousRequestToARModel(user.AnonymousRequest) }; userModel.Bookings = user.Bookings.Select(b => BookingMappings.MapBookingToBookingModel(b, userModel)).ToList(); userModel.DriverServices = user.DriverServices.Select(ds => DriverServiceMappings.MapDriverServiceToDriverServiceModel(ds, null, userModel)).ToList(); userModel.UserRoles = user.AspNetRoles.Select(r => RoleMappings.MapRoleToRoleModel(r)).ToList(); return(userModel); }
public static UserRequestModel MapUserRequestToURModel(UserRequest request) { return(new UserRequestModel { Birthday = request.Birthday, Email = request.Email, EmailConfirmed = request.EmailConfirmed, FName = request.FirstName, LName = request.LastName, Gender = request.Gender, PhoneNumber = request.PhoneNumber, RequestId = request.Id, RoleId = request.RoleId, Role = RoleMappings.MapRoleToRoleModel(request.Role) }); }