public ActionResult Add(LegalEntityOwnerView legalEntityOwnerView, FormCollection form) { if (ModelState.IsValid) { ILegalEntityOwnersRepository legalEntityOwnersRepository = new LegalEntityOwnersRepository(db); LegalEntityOwner legalEntityOwner = new LegalEntityOwner(); legalEntityOwnerView.ConvertTo(legalEntityOwnerView, legalEntityOwner); legalEntityOwnersRepository.Add(legalEntityOwner); legalEntityOwnersRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("INSERT", legalEntityOwner.LegalEntityOwnerPK); if (TempData["legalEntityFK"] != null) { return(RedirectToAction("Index", "LegalEntity")); } else { return(RedirectToAction("Index", "LegalEntityOwner")); } } else { legalEntityOwnerView.BindDLLs(legalEntityOwnerView, db); return(View(legalEntityOwnerView)); } }
public ActionResult Delete(int?legalEntityOwnerPK) { ILegalEntityOwnersRepository legalEntityOwnersRepository = new LegalEntityOwnersRepository(db); if (legalEntityOwnerPK != null) { LegalEntityOwner legalEntityOwner = legalEntityOwnersRepository.GetLegalEntityOwnerByPK((int)legalEntityOwnerPK); legalEntityOwner.Deleted = true; legalEntityOwnersRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("DELETE", legalEntityOwner.LegalEntityOwnerPK); } return(Redirect(Request.UrlReferrer.AbsoluteUri)); }
public ActionResult Edit(LegalEntityOwnerView legalEntityOwnerView, FormCollection form) { if (ModelState.IsValid) { ILegalEntityOwnersRepository legalEntityOwnersRepository = new LegalEntityOwnersRepository(db); LegalEntityOwner legalEntityOwner = legalEntityOwnersRepository.GetLegalEntityOwnerByPK((int)legalEntityOwnerView.LegalEntityOwnerPK); legalEntityOwnerView.ConvertTo(legalEntityOwnerView, legalEntityOwner); legalEntityOwnersRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("UPDATE", legalEntityOwner.LegalEntityOwnerPK); return(RedirectToAction("Index", "LegalEntityOwner")); } else { legalEntityOwnerView.BindDLLs(legalEntityOwnerView, db); return(View(legalEntityOwnerView)); } }