public ActionResult Create(RelationshipTypeVM model) { try { if (!ModelState.IsValid) { return(View(model)); } var relationshipType = _mapper.Map <RelationshipType>(model); var isSuccess = _repo.Create(relationshipType); if (!isSuccess) { ModelState.AddModelError("", "Something Went Wrong..."); } return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Delete(int id, RelationshipTypeVM model) { try { var relationshipType = _repo.FindById(id); if (relationshipType == null) { return(NotFound()); } var isSuccess = _repo.Delete(relationshipType); if (!isSuccess) { return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { return(View(model)); } }