Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        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));
            }
        }