public ActionResult <Volunteer> PostVolunteer(Volunteer volunteer) { _context.Volunteer.Add(volunteer); _context.SaveChanges(); return(CreatedAtAction("GetVolunteer", new { id = volunteer.VolunteerId }, volunteer)); }
public ActionResult <User> PostUser(User user) { _context.User.Add(user); try { _context.SaveChanges(); } catch (DbUpdateException) { if (UserExists(user.Email)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetUser", new { id = user.Email }, user)); }