public IActionResult Create([Bind("Id, OwnerPersonalId, Name,Email,PhoneNumber,Address")] Owner owner) { try { if (ModelState.IsValid) { _ownerRepository.AddEntity(owner); _ownerRepository.Commit(); return(RedirectToAction("Index")); } } catch (DbUpdateException ex) { ModelState.AddModelError("Creating owner", "Failed to create a new owner. " + ex.Message); } return(View(owner)); }