Пример #1
0
 public IActionResult Edit(EditCountyModel model)
 {
     if (ModelState.IsValid)
     {
         countyService.Update(model.Id, model.Name);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(model));
 }
Пример #2
0
        public ActionResult EditCounty(EditCountyModel model)
        {
            if (ModelState.IsValid)
            {
                var updatedCounty = new County()
                {
                    Name      = model.Name,
                    ShortName = model.ShortName,
                    IdCounty  = model.CountyId
                };

                Services.LocalitiesService.UpdateCounty(updatedCounty);
            }

            return(RedirectToAction("EditCounty", new { id = model.CountyId }));
        }
Пример #3
0
        public ActionResult EditCounty(int id)
        {
            var county = Services.LocalitiesService.GetCounty(id);

            if (county == null)
            {
                return(HttpNotFound());
            }

            var model = new EditCountyModel()
            {
                CountyId  = county.IdCounty,
                Name      = county.Name,
                ShortName = county.ShortName
            };

            return(View(model));
        }