コード例 #1
0
 public ActionResult Edit(SalesPromotionModel.SalesPromotionModelShow item, int p = 1)
 {
     {
         s26webDataContext db = new s26webDataContext();
         var old = db.SalesPromotion.FirstOrDefault(f => f.Id == item.Id);
         db.Connection.Close();
         if (data.Update(item) <= 0)
         {
             TempData["err"] = "SalesPromotion_5";
             return RedirectToAction("Index");
         }
     }
     return RedirectToAction("Index", new { p = p });
 }
コード例 #2
0
 public ActionResult Create(SalesPromotionModel.SalesPromotionModelShow item)
 {
     try
     {
         string deadline = item.Deadline.ToString("").Substring(0,9) + " 下午 03:59:59";
         item.Deadline = DateTime.Parse(deadline);
         if (data.Insert(item) <= 0)
         {
             TempData["err"] = "SalesPromotion_0";
             return RedirectToAction("Index");
         }
     }
     catch { TempData["err"] = "SalesPromotion_1"; }
     return RedirectToAction("Index");
 }