public ActionResult Index(CountryViewModel model, string submit_Country, string submit_State, string submit_City) { try { if (submit_Country != (null)) { //entity.InsertUpdateSelectAdmin(0, model.Name, model.Address, model.MobileNo, model.EmailId, model.gender, model.dob, model.countryId, model.stateId, model.cityId, 1, true); entity.InsertUpdateSelectCountry(0, model.countryName, true, 1); } else if (submit_State != (null)) { entity.InsertUpdateSelectState(0, model.stateName, true, 1, model.countryId); } else if (submit_City != (null)) { entity.InsertUpdateSelectCity(0, model.cityName, true, 1, model.countryId2, model.stateId); } //entity.InsertUpdateSelectCountry(0, model.countryName, true, 1); ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName"); ViewBag.stateDd = new SelectList(entity.states.Where(models => models.Active == true), "stateId", "stateName"); ViewBag.cityDd = new SelectList(entity.cities.Where(models => models.Active == true), "cityId", "cityName"); ViewBag.alert = "Success"; } catch (Exception e1) { ViewBag.alert = "Error"; } return(View()); }
public string DeleteCustomer(int Id) { string msg; if (ModelState.IsValid) { entity.InsertUpdateSelectCountry(Id, "abc", true, 3); //entity.Entry(Model).State = EntityState.Modified; //entity.SaveChanges(); msg = "Deleted Successfully"; } else { msg = "Validation data not successfully"; } return(msg); }