Exemplo n.º 1
0
        public ActionResult <Volunteer> PostVolunteer(Volunteer volunteer)
        {
            _context.Volunteer.Add(volunteer);
            _context.SaveChanges();

            return(CreatedAtAction("GetVolunteer", new { id = volunteer.VolunteerId }, volunteer));
        }
Exemplo n.º 2
0
        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));
        }