public ActionResult Edit(TblStoreInformation tblStoreInformation, HttpPostedFileBase fileName) { tblStoreInformation.ModifiedBy = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString())); tblStoreInformation.ModifiedDate = DateTime.Now; try { if (fileName != null) { //BaseUtil.DeleteAlreadyExistingFile(tblStoreInformation.Logo, "/Content/Images"); tblStoreInformation.Logo = tblStoreInformation.Logo = BaseUtil.UploadFile(fileName, "/Content/Images"); } ViewBag.CompanyTypeID = new SelectList(db.TblCompanyTypes.Where(e => e.IsActive == true), "CompanyTypeID", "CompanyType", tblStoreInformation.CompanyTypeID); if (ModelState.IsValid) { db.Entry(tblStoreInformation).State = EntityState.Modified; db.SaveChanges(); TempData["msg"] = "2"; return(RedirectToAction("Index")); } TempData["msg"] = "0"; } catch (Exception ex) { TempData["msg"] = "0"; } return(View(tblStoreInformation)); }
// GET: StoreInformations/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TblStoreInformation tblStoreInformation = db.TblStoreInformations.Find(id); if (tblStoreInformation == null) { return(HttpNotFound()); } BaseUtil.SetSessionValue(AdminInfo.StoreID.ToString(), id.ToString()); return(View(tblStoreInformation)); }
// GET: StoreInformations/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TblStoreInformation tblStoreInformation = db.TblStoreInformations.Find(id); if (tblStoreInformation == null) { return(HttpNotFound()); } BaseUtil.SetSessionValue(AdminInfo.StoreID.ToString(), id.ToString()); ViewBag.CompanyTypeID = new SelectList(db.TblCompanyTypes.Where(e => e.IsActive == true), "CompanyTypeID", "CompanyType", tblStoreInformation.CompanyTypeID); return(View(tblStoreInformation)); }
public ActionResult Create(TblStoreInformation tblStoreInformation, HttpPostedFileBase fileName) { try { ViewBag.CompanyTypeID = new SelectList(db.TblCompanyTypes.Where(e => e.IsActive == true), "CompanyTypeID", "CompanyType", tblStoreInformation.CompanyTypeID); tblStoreInformation.IsActive = true; tblStoreInformation.IsDelete = false; tblStoreInformation.ModifiedBy = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString()));; tblStoreInformation.ModifiedDate = DateTime.Now; tblStoreInformation.CreatedBy = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString())); tblStoreInformation.CreatedDate = DateTime.Now; tblStoreInformation.ThemeID = 1; var price = db.TblStoreFees.FirstOrDefault(); tblStoreInformation.storeCreationFee = price.Fee; if (ModelState.IsValid) { if (fileName != null) { tblStoreInformation.Logo = BaseUtil.UploadFile(fileName, "/Content/Images"); } else { tblStoreInformation.Logo = "/Content/Images/emptyLogo.jpg"; } db.TblStoreInformations.Add(tblStoreInformation); db.SaveChanges(); TempData["msg"] = "1"; return(RedirectToAction("Index")); } TempData["msg"] = "0"; } catch (Exception ex) { TempData["msg"] = "0"; } return(View(tblStoreInformation)); }