public ActionResult Add()
 {
     try
     {
         ViewBag.ActiveURL = "/Admin/states";
         StateSaveModel model = new StateSaveModel();
         model.CountryList = objAPI.GetAllRecords <CountryDD>("configuration", "CountriesList");
         return(View(model));
     }
     catch (AuthorizationException)
     {
         TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again";
         return(RedirectToAction("Login", "Account", new { Area = "" }));
     }
 }
 public ActionResult Edit(StateSaveModel model)
 {
     try
     {
         ViewBag.ActiveURL = "/Admin/states";
         if (ModelState.IsValid)
         {
             string jsonStr = JsonConvert.SerializeObject(model.State);
             TempData["ErrMsg"] = objAPI.PostRecordtoApI("configuration", "savestate", jsonStr);
             return(RedirectToAction("index", "states", new { Area = "Admin" }));
         }
         model.CountryList = objAPI.GetAllRecords <CountryDD>("configuration", "CountriesList");
         return(View(model));
     }
     catch (AuthorizationException)
     {
         TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again";
         return(RedirectToAction("Login", "Account", new { Area = "" }));
     }
 }