예제 #1
0
        public ActionResult Add(LegalEntityView legalEntityView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db);
                LegalEntity legalEntity = new LegalEntity();

                legalEntityView.ConvertTo(legalEntityView, legalEntity);

                legalEntitiesRepository.Add(legalEntity);
                legalEntitiesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", legalEntity.LegalEntityPK);

                return(RedirectToAction("Index", "LegalEntity", new { active = "true" }));
            }
            else
            {
                legalEntityView.BindDDLs(legalEntityView, db);

                return(View(legalEntityView));
            }
        }