public static User ToUser(UserPostModel userModel) { //UserRole rol = Lab3.Models.UserRole.Regular; //if (userModel.UserRole == "UserManager") //{ // rol = Lab3.Models.UserRole.UserManager; //} //else if (userModel.UserRole == "Admin") //{ // rol = Lab3.Models.UserRole.Admin; //} return(new User { FirstName = userModel.FirstName, LastName = userModel.LastName, Username = userModel.UserName, Email = userModel.Email, Password = ComputeSha256Hash(userModel.Password) }); }
public static User ToUser(UserPostModel userModel) { UserRole rol = TaskAgendaProj.Models.UserRole.Regular; if (userModel.UserRole == "UserManager") { rol = TaskAgendaProj.Models.UserRole.UserManager; } else if (userModel.UserRole == "Admin") { rol = TaskAgendaProj.Models.UserRole.Admin; } return(new User { FirstName = userModel.FirstName, LastName = userModel.LastName, Username = userModel.Username, Email = userModel.Email, Password = ComputeSha256Hash(userModel.Password), UserRole = rol }); }