public void CreateEventDetails(EventDetail eventDetail) { if (eventDetail.EventDetailId.ToString() is null) { throw new HttpStatusCodeException((int)HttpStatusCode.BadRequest, "You need to create event first"); } db.EventDetail.Add(eventDetail); db.SaveChanges(); }
public User Create(User user, string password) { // validation if (string.IsNullOrWhiteSpace(password)) { throw new HttpStatusCodeException(400, "Password is required"); } if (_context.User.Any(x => x.Username == user.Username)) { throw new HttpStatusCodeException(400, "Username \"" + user.Username + "\" 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 void CreateTournament(Tournament tournament) { Db.Tournament.Add(tournament); Db.SaveChanges(); }
public void CreateEvent(Event Event) { Db.Event.Add(Event); Db.SaveChanges(); }