public async Task <IActionResult> PutObject([FromRoute] Guid Id, [FromBody] Ansurance obj) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (Id != obj.Id) { return(BadRequest()); } _context.Entry(obj).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Exists(Id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostObject([FromBody] Ansurance obj) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Assurances.Add(obj); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAssurances", new { Id = obj.Id }, obj)); }