Пример #1
0
 public ActionResult CreateEdit(CityViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (CityDataAccess.Update(model))
             {
                 return(Json(new { success = true, message = "success" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { succes = false, message = CityDataAccess.Message }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             return(Json(new { success = false, message = "Please full fill required fields" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Пример #2
0
        public City UpdateCity(UpdateCityRequest request)
        {
            City city = null;

            if (request != null && request.City != null)
            {
                var dataAccess = new CityDataAccess(request.Context);

                city = dataAccess.Update(request.City);
            }

            return(city);
        }