public async Task <IActionResult> PostGreusers([FromBody] Greusers greusers) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Greusers.Add(greusers); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (GreusersExists(greusers.Email)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetGreusers", new { id = greusers.Email }, greusers)); }
public async Task <IActionResult> PutGreusers([FromRoute] string id, [FromBody] Greusers greusers) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != greusers.Email) { return(BadRequest()); } _context.Entry(greusers).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GreusersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }