Example #1
0
        public ActionResult Add(LegalEntityLegalRepresentativeView legalEntityLegalRepresentativeView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);
                LegalEntityLegalRepresentative             legalEntityLegalRepresentative            = new LegalEntityLegalRepresentative();

                legalEntityLegalRepresentativeView.ConvertTo(legalEntityLegalRepresentativeView, legalEntityLegalRepresentative);

                legalEntityLegalRepresentativesRepository.Add(legalEntityLegalRepresentative);
                legalEntityLegalRepresentativesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK);

                if (TempData["legalEntityFK"] != null)
                {
                    return(RedirectToAction("Index", "LegalEntity"));
                }
                else
                {
                    return(RedirectToAction("Index", "LegalEntityLegalRepresentative"));
                }
            }
            else
            {
                legalEntityLegalRepresentativeView.BindDDLs(legalEntityLegalRepresentativeView, db);

                return(View(legalEntityLegalRepresentativeView));
            }
        }
Example #2
0
        public ActionResult Delete(int?legalEntityLegalRepresentativePK)
        {
            ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);

            if (legalEntityLegalRepresentativePK != null)
            {
                LegalEntityLegalRepresentative legalEntityLegalRepresentative = legalEntityLegalRepresentativesRepository.GetLegalEntityLegalRepresentativeByPK((int)legalEntityLegalRepresentativePK);

                legalEntityLegalRepresentative.Deleted = true;

                legalEntityLegalRepresentativesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Example #3
0
        public ActionResult Edit(LegalEntityLegalRepresentativeView legalEntityLegalRepresentativeView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);
                LegalEntityLegalRepresentative             legalEntityLegalRepresentative            = legalEntityLegalRepresentativesRepository.GetLegalEntityLegalRepresentativeByPK((int)legalEntityLegalRepresentativeView.LegalEntityLegalRepresentativePK);
                legalEntityLegalRepresentativeView.ConvertTo(legalEntityLegalRepresentativeView, legalEntityLegalRepresentative);

                legalEntityLegalRepresentativesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK);

                return(RedirectToAction("Index", "LegalEntityLegalRepresentative"));
            }
            else
            {
                legalEntityLegalRepresentativeView.BindDDLs(legalEntityLegalRepresentativeView, db);

                return(View(legalEntityLegalRepresentativeView));
            }
        }