public async Task <IActionResult> Edit(Guid id, [Bind("CustomerId,FirstName,LastName,PNr")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { await _customersRepo.Update(customer); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> PutCustomer([FromRoute] int id, [FromBody] Customer customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer.Id) { return(BadRequest()); } _repo.Update(customer); return(NoContent()); }