示例#1
0
        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));
        }
示例#2
0
        // 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));
        }
示例#3
0
        // 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));
        }
示例#4
0
        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));
        }