public async Task <IActionResult> PutAddresses([FromRoute] int id, [FromBody] Addresses addresses) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != addresses.AddressId) { return(BadRequest()); } _context.Entry(addresses).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddressesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("AddressId")] Addresses addresses) { if (ModelState.IsValid) { _context.Add(addresses); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(addresses)); }