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()); } }
public ActionResult EditAllInforAboutShop(long id) { var objShop = _shopsBusiness.GetById(id); if (objShop != null) { LoadDropdown loadDropdown = new LoadDropdown(); ViewBag.Location = loadDropdown.SearchLocationParenId(1, objShop.LocationId); LoadCombo loadDropStatus = new LoadCombo(); ViewBag.StatusShop = loadDropStatus.LoadStatus(); return(View(objShop)); } return(RedirectToAction("Index")); }