public ActionResult EditStore(EditStoreModel model, int storeId = -1) { StoreInfo storeInfo = AdminStores.GetStoreById(storeId); if (storeInfo == null) return PromptView("店铺不存在"); int storeId2 = AdminStores.GetStoreIdByName(model.StoreName); if (storeId2 > 0 && storeId2 != storeId) ModelState.AddModelError("StoreName", "店铺名已经存在"); if (ModelState.IsValid) { storeInfo.State = model.State; storeInfo.Name = model.StoreName; storeInfo.RegionId = model.RegionId; storeInfo.StoreRid = model.StoreRid; storeInfo.StoreIid = model.StoreIid; storeInfo.Logo = model.Logo == null ? "" : model.Logo; storeInfo.Mobile = model.Mobile == null ? "" : model.Mobile; storeInfo.Phone = model.Phone == null ? "" : model.Phone; storeInfo.QQ = model.QQ == null ? "" : model.QQ; storeInfo.WW = model.WW == null ? "" : model.WW; storeInfo.Honesties = model.StoreRid == storeInfo.StoreRid ? storeInfo.Honesties : AdminStoreRanks.GetStoreRankById(model.StoreRid).HonestiesLower; storeInfo.StateEndTime = TypeHelper.StringToDateTime(model.StateEndTime); storeInfo.Theme = model.Theme; storeInfo.Banner = model.Banner == null ? "" : model.Banner; storeInfo.Announcement = model.Announcement == null ? "" : model.Announcement; storeInfo.Description = model.Description == null ? "" : model.Description; AdminStores.UpdateStore(storeInfo); AddMallAdminLog("修改店铺", "修改店铺,店铺ID为:" + storeId); return PromptView("店铺修改成功"); } LoadStore(storeId, model.RegionId); return View(model); }
public ActionResult EditStore(int storeId = -1) { StoreInfo storeInfo = AdminStores.GetStoreById(storeId); if (storeInfo == null) return PromptView("店铺不存在"); EditStoreModel model = new EditStoreModel(); model.State = storeInfo.State; model.StoreName = storeInfo.Name; model.RegionId = storeInfo.RegionId; model.StoreRid = storeInfo.StoreRid; model.StoreIid = storeInfo.StoreIid; model.Logo = storeInfo.Logo; model.Mobile = storeInfo.Mobile; model.Phone = storeInfo.Phone; model.QQ = storeInfo.QQ; model.WW = storeInfo.WW; model.StateEndTime = storeInfo.StateEndTime.ToString(); model.Theme = storeInfo.Theme; model.Banner = storeInfo.Banner; model.Announcement = storeInfo.Announcement; model.Description = storeInfo.Description; LoadStore(storeId, model.RegionId); return View(model); }