public ActionResult Edit(CityViewModel model) { model.Countries = HealthHelper.GetAllCountries(); try { var svc = new GeoCityAppService(); var o = new GeoCity { GeoCityId = model.GeoCityId, Name = model.Name, GeoStateId = model.GeoStateId, Latitude = model.Latitude, Longitude = model.Longitude }; if (model.Action == "-1") { var exist = svc.GetGeoCity(model.GeoCityId) != null; if (!exist) { svc.AddGeoCity(o); ViewBag.Feed = 0; } else { model.Action = "-1"; ViewBag.Feed = 3; return View(model); } } else { o.GeoCityId = model.GeoCityId; if (model.IsDeleteAction == 0) { svc.SaveGeoCity(o); } else { svc.RemoveGeoCity(model.GeoCityId); } ViewBag.Feed = 0; } } catch (Exception) { ViewBag.Feed = 1; } return View(model); }