public ActionResult DetailsPost(CountryDetailsVM objDetailsVM, string Submit, HttpPostedFileBase file) { CommonBL objCommonBL = null; try { if (Submit == "Save") { objCountryBL = new CountryBL(); objCommonBL = new CommonBL(); objDetailsVM.CntMstr.Status = 1; //if (file != null) //{ // string path = "~/Content/profileimages/" + Guid.NewGuid() + file.FileName; // file.SaveAs(Server.MapPath(path)); // //objDetailsVM.User.ImageUrl = path;//.Substring(2, path.Length - 2); //} objResponse = objCountryBL.SaveCountry(objDetailsVM.CntMstr, objDetailsVM.CntMstr.CountryID > 0 ? "U" : "C"); // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 }); objDetailsVM.Toast = WebCommon.SetToast(objResponse, "Country", "Index"); } return(View(objDetailsVM)); } catch (Exception ex) { throw ex; } finally { objCountryBL = null; objDetailsVM = null; objCommonBL = null; } }
protected void btnSave_Click(object sender, EventArgs e) { Countrytbl ls = new Countrytbl(); ls.CountryName = txtCountry.Text; ls.IsActive = 1; ls.CreatedBy = 1; ls.CreatedDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); List <Countrytbl> lst = new List <Countrytbl>(); lst = objCountryBL.SaveCountry(ls).ToList(); ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage('Country Saved Successfully');", true); Clear(); GetCountry(); }
public ActionResult Action(CountryMasterFilter objFilter, string submit) { CommonBL objCommonBL = null; CountryMaster objCountry = null; try { objDetailsVM = new CountryDetailsVM(); if (submit.ToLower() == "edit") { objCommonBL = new CommonBL(); TempData["CountryFilter"] = objFilter; objCountryBL = new CountryBL(); objDetailsVM = new CountryDetailsVM(); objDetailsVM.CntMstr = objCountryBL.GetData(new CountryMasterFilter() { CountryID = objFilter.CountryID }).FirstOrDefault(); // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 }); return(View("Details", objDetailsVM)); } else if (submit.ToLower() == "delete") { objCountryBL = new CountryBL(); objListVM = new CountryMasterListVM(); objCountry = new CountryMaster(objFilter.CountryID); objCountry.ModifiedBy = 1; objCountry.Remark = "Deleted"; objResponse = objCountryBL.SaveCountry(objCountry, "D"); objFilter.CountryID = 0; objListVM = GetCountryListVM(objFilter); objListVM.Toast = WebCommon.SetToast(objResponse); return(View("Index", objListVM)); } } catch (Exception ex) { throw; } finally { objCountryBL = null; objDetailsVM = null; objListVM = null; objCommonBL = null; } return(null); }