public async Task <IActionResult> PutCustomer([FromRoute] int id, [FromBody] Customer customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer.CustomerId) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> AddAdmin(Adminstrator newAdmin) { if (ModelState.IsValid) { _adb.Add(newAdmin); await _adb.SaveChangesAsync(); return(RedirectToAction("AIndex")); } return(View(newAdmin)); }