public ActionResult EditSuitPromotion(SuitPromotionModel model, int pmId = -1) { SuitPromotionInfo suitPromotionInfo = AdminPromotions.AdminGetSuitPromotionById(pmId); if (suitPromotionInfo == null) return PromptView("套装促销活动不存在"); if (ModelState.IsValid) { DateTime noTime = new DateTime(1900, 1, 1); suitPromotionInfo.StartTime1 = model.StartTime1; suitPromotionInfo.EndTime1 = model.EndTime1; suitPromotionInfo.StartTime2 = model.StartTime2.HasValue ? model.StartTime2.Value : noTime; suitPromotionInfo.EndTime2 = model.EndTime2.HasValue ? model.EndTime2.Value : noTime; suitPromotionInfo.StartTime3 = model.StartTime3.HasValue ? model.StartTime3.Value : noTime; suitPromotionInfo.EndTime3 = model.EndTime3.HasValue ? model.EndTime3.Value : noTime; suitPromotionInfo.UserRankLower = model.UserRankLower; suitPromotionInfo.State = model.State; suitPromotionInfo.Name = model.PromotionName; suitPromotionInfo.QuotaUpper = model.QuotaUpper; suitPromotionInfo.OnlyOnce = model.OnlyOnce; AdminPromotions.UpdateSuitPromotion(suitPromotionInfo); AddMallAdminLog("修改套装促销活动", "修改套装促销活动,套装促销活动ID为:" + pmId); return PromptView("套装促销活动修改成功"); } LoadSuitPromotion(); return View(model); }
public ActionResult AddSuitPromotion(SuitPromotionModel model) { if (ModelState.IsValid) { DateTime noTime = new DateTime(1900, 1, 1); SuitPromotionInfo suitPromotionInfo = new SuitPromotionInfo() { StoreId = model.StoreId, StartTime1 = model.StartTime1, EndTime1 = model.EndTime1, StartTime2 = model.StartTime2.HasValue ? model.StartTime2.Value : noTime, EndTime2 = model.EndTime2.HasValue ? model.EndTime2.Value : noTime, StartTime3 = model.StartTime3.HasValue ? model.StartTime3.Value : noTime, EndTime3 = model.EndTime3.HasValue ? model.EndTime3.Value : noTime, UserRankLower = model.UserRankLower, State = model.State, Name = model.PromotionName, QuotaUpper = model.QuotaUpper, OnlyOnce = model.OnlyOnce }; AdminPromotions.CreateSuitPromotion(suitPromotionInfo); AddMallAdminLog("添加套装促销活动", "添加套装促销活动,套装促销活动为:" + model.PromotionName); return PromptView("套装促销活动添加成功"); } LoadSuitPromotion(); return View(model); }
public ActionResult EditSuitPromotion(int pmId = -1) { SuitPromotionInfo suitPromotionInfo = AdminPromotions.AdminGetSuitPromotionById(pmId); if (suitPromotionInfo == null) return PromptView("套装促销活动不存在"); DateTime? nullTime = null; DateTime noTime = new DateTime(1900, 1, 1); SuitPromotionModel model = new SuitPromotionModel(); model.StartTime1 = suitPromotionInfo.StartTime1; model.EndTime1 = suitPromotionInfo.EndTime1; model.StartTime2 = suitPromotionInfo.StartTime2 == noTime ? nullTime : suitPromotionInfo.StartTime2; model.EndTime2 = suitPromotionInfo.EndTime2 == noTime ? nullTime : suitPromotionInfo.EndTime2; model.StartTime3 = suitPromotionInfo.StartTime3 == noTime ? nullTime : suitPromotionInfo.StartTime3; model.EndTime3 = suitPromotionInfo.EndTime3 == noTime ? nullTime : suitPromotionInfo.EndTime3; model.UserRankLower = suitPromotionInfo.UserRankLower; model.State = suitPromotionInfo.State; model.PromotionName = suitPromotionInfo.Name; model.QuotaUpper = suitPromotionInfo.QuotaUpper; model.OnlyOnce = suitPromotionInfo.OnlyOnce; model.StoreId = suitPromotionInfo.StoreId; model.StoreName = AdminStores.GetStoreById(suitPromotionInfo.StoreId).Name; LoadSuitPromotion(); return View(model); }
public ActionResult AddSuitPromotion() { SuitPromotionModel model = new SuitPromotionModel(); LoadSuitPromotion(); return View(model); }