public IActionResult Put(int id, [FromBody] Proprietor Proprietor) { if (Proprietor == null || id != Proprietor.ID) { return(BadRequest()); } var Prop = repository.Proprietors.SingleOrDefault(x => x.ID == id); if (Prop == null) { return(NotFound()); } repository.EditProprietor(Proprietor); return(CreatedAtAction(nameof(Get), new { id = Proprietor.ID }, Proprietor)); }
public ViewResult EditProprietor(Proprietor proprietor) { if (ModelState.IsValid) { var existing = proprietorRepository.IsRegistered(proprietor) != null; if (existing) { proprietorRepository.EditProprietor(proprietor); } return(View("ProprietorList", proprietorRepository.Proprietors)); } else { return(View(proprietor)); } //return View("ProprietorList", proprietorRepository.Proprietors); }