public async Task <IActionResult> PutEntityAddressType([FromRoute] int id, [FromBody] EntityAddressType entityAddressType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != entityAddressType.Id) { return(BadRequest()); } _context.Entry(entityAddressType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EntityAddressTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostEntityAddressType([FromBody] EntityAddressType entityAddressType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.EntityAddressTypes.Add(entityAddressType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEntityAddressType", new { id = entityAddressType.Id }, entityAddressType)); }