Exemplo n.º 1
0
        public ActionResult Add()
        {
            CountyView countyView = new CountyView();

            countyView.BindDDLs(countyView, db);

            return(View(countyView));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int?countyPK)
        {
            if (countyPK != null)
            {
                ICountiesRepository countiesRepository = new CountiesRepository(db);
                County     county     = countiesRepository.GetCountyByPK((int)countyPK);
                CountyView countyView = new CountyView();

                countyView.ConvertFrom(county, countyView);
                countyView.BindDDLs(countyView, db);

                return(View(countyView));
            }
            else
            {
                return(RedirectToAction("Index", "County"));
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit(CountyView countyView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                ICountiesRepository countiesRepository = new CountiesRepository(db);
                County county = countiesRepository.GetCountyByPK((int)countyView.CountyPK);

                countyView.ConvertTo(countyView, county);

                countiesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", county.CountyPK);

                return(RedirectToAction("Index", "County"));
            }
            else
            {
                countyView.BindDDLs(countyView, db);

                return(View(countyView));
            }
        }