예제 #1
0
 public JsonResult UpdateShop(Common.Shop obj)
 {
     try
     {
         ShopsBusiness _shopsBusiness = new ShopsBusiness();
         var           objentity      = _shopsBusiness.GetById(obj.Id);
         objentity.Id         = obj.Id;
         objentity.ShopName   = obj.ShopName;
         objentity.Icon       = obj.Icon;
         objentity.Address    = obj.Address;
         objentity.LocationId = obj.LocationId;
         objentity.Phone      = obj.Phone;
         objentity.Rate       = obj.Rate;
         objentity.TotalView  = obj.TotalView;
         objentity.Type       = obj.Type;
         objentity.Status     = obj.Status;
         objentity.BeginDate  = obj.BeginDate;
         objentity.EndDate    = obj.EndDate;
         objentity.ActiveDate = obj.ActiveDate;
         objentity.CreateDate = obj.CreateDate;
         objentity.ModifyDate = DateTime.Now;
         _shopsBusiness.Edit(objentity);
         return(Json(1));//Cập nhật thành công
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
        public ActionResult EditAllInforAboutShop(Shop objShop, long receiverPhuong, HttpPostedFileBase iconShop)
        {
            ShopsBusiness        shopBusiness        = new ShopsBusiness();
            ShopSettingsBusiness shopSettingBusiness = new ShopSettingsBusiness();

            LoadDropdown loadDropdown = new LoadDropdown();

            ViewBag.Location = loadDropdown.SearchLocationParenId(1, objShop.LocationId);
            LoadCombo loadDropStatus = new LoadCombo();

            ViewBag.StatusShop = loadDropStatus.LoadStatus();
            if (ModelState.IsValid && objShop != null)
            {
                var objShopDB = shopBusiness.GetById(objShop.Id);

                objShopDB.ShopName = objShop.ShopName;
                objShopDB.Address  = objShop.Address;
                objShopDB.Phone    = objShop.Phone;
                ////temp, sửa lại là dropdown
                //objShopDB.Type = objShop.Type;
                //objShopDB.Status = objShop.Status;
                objShopDB.LocationId = receiverPhuong;
                //objShopDB.ActiveDate = DateTime.ParseExact(datepicker1, "dd/MM/yyyy", null);

                if (iconShop != null && iconShop.ContentLength > 0)
                {
                    string randomImage = Guid.NewGuid().ToString();
                    string pathImage   = HttpContext.Server.MapPath("~/FileUpload");
                    string strurlimage = Function.ResizeImageNew(iconShop, 300, 300, pathImage, randomImage);
                    Function.ResizeImageNew(iconShop, 500, 500, pathImage, randomImage);
                    Function.ResizeImageNew(iconShop, 1000, 1000, pathImage, randomImage);
                    objShopDB.Icon = strurlimage;
                }

                shopBusiness.Edit(objShopDB);
                return(View(objShopDB));
                ////cập nhật shopSetting
                //var objShopSettingDB = shopSettingBusiness.GetDynamicQuery().Where(x => x.ShopId == objShop.Id).FirstOrDefault();
                //if(objShopSettingDB != null)
                //{
                //    objShopSettingDB.Key = keyShopSetting;
                //    objShopSettingDB.Value = valueShopSetting;

                //    shopSettingBusiness.Edit(objShopSettingDB);
                //}
                //else
                //{
                //    ShopSetting objShopSetting = new ShopSetting();
                //    objShopSetting.ShopId = objShop.Id;
                //    objShopSetting.Key = keyShopSetting;
                //    objShopSetting.Value = valueShopSetting;

                //    shopSettingBusiness.AddNew(objShopSetting);
                //}
            }
            else
            {
                return(View());
            }
        }