public TravelUser AddUser(TravelUser User, TravelUserRoleMapping Role) { System.Guid guid = System.Guid.NewGuid(); User.GeneratePasswordKey = guid; User.CreatedOn = DateTime.UtcNow; _context.TravelUsers.Add(User); _context.SaveChanges(); Role.UserID = User.ID; _context.TravelUserRoleMappings.Add(Role); _context.SaveChanges(); return(User); }
// Insert user public UserModel AddUser(TravelUserViewModel traveluser) { TravelUser UserData = new TravelUser(); TravelUserRoleMapping UserRoleData = new TravelUserRoleMapping(); UserData.Email = traveluser.Email; UserData.UserName = traveluser.Email; UserData.FirstName = traveluser.FirstName; UserData.LastName = traveluser.LastName; //UserData.Password = "******"; UserData.IsActive = 1; UserRoleData.RoleID = traveluser.RoleId; TravelUser data = _adminRepository.AddUser(UserData, UserRoleData); return(AutoMapper.Mapper.Map <TravelUser, UserModel>(data)); }