public User Create(User user, string password) { // validation if (string.IsNullOrWhiteSpace(password)) { throw new AppException("Password is required"); } var userValid = _context.User.FirstOrDefault(u => u.Email == user.Email); if (userValid != null) { throw new AppException("Email \"" + user.Email + "\" is already taken"); } byte[] passwordHash, passwordSalt; CreatePasswordHash(password, out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; _context.User.Add(user); _context.SaveChanges(); return(user); }
public Language Create(Language language) { _context.Language.Add(language); _context.SaveChanges(); return(language); }
public Work Create(Work work) { _context.Add(work); _context.SaveChanges(); return(work); }
public Education Create(Education education) { _context.Education.Add(education); _context.SaveChanges(); return(education); }
public Portfolio Create(Portfolio portfolio) { _context.Portfolio.Add(portfolio); _context.SaveChanges(); return(portfolio); }
public Skill Create(Skill skill) { _context.Skill.Add(skill); _context.SaveChanges(); return(skill); }