Пример #1
0
 public ActionResult Edit(ExchangGifts eGift)
 {
     try
     {
         HttpPostedFileBase file = Request.Files[0];
         string[] cols;
         if (file.ContentLength > 0)
         {
             string fileName = Path.GetFileName(file.FileName);
             file.SaveAs(Request.MapPath("/Filters/" + fileName));
             eGift.EG_Photo = fileName;
             cols = new string[] { "EG_GiftName", "EG_Photo", "EG_Point", "EG_Number", "EG_Remark" };
         }
         else
         {
             cols = new string[] { "EG_GiftName", "EG_Point", "EG_Number", "EG_Remark" };
         }
         ExchangGiftsBLL bll = new ExchangGiftsBLL();
         bll.Edit(eGift, cols);
         bll.SaveChanges();
         return Content("ok");
     }
     catch
     {
         return Content("error");
     }
 }
Пример #2
0
 public ActionResult Create(ExchangGifts eGift)
 {
     try
     {
         HttpPostedFileBase file = Request.Files[0];
         if (file.ContentLength > 0)
         {
             string fileName = Path.GetFileName(file.FileName);
             file.SaveAs(Request.MapPath("/Filters/" + fileName));
             eGift.EG_Photo = fileName;
         }
         ExchangGiftsBLL bll = new ExchangGiftsBLL();
         eGift.S_ID = (Session["user"] as Users).S_ID;
         eGift.EG_ExchangNum = 0;
         bll.Add(eGift);
         bll.SaveChanges();
         return Content("ok");
     }
     catch
     {
         return Content("error");
     }
 }
Пример #3
0
 /// <summary>
 /// 创建新的 ExchangGifts 对象。
 /// </summary>
 /// <param name="eG_ID">EG_ID 属性的初始值。</param>
 public static ExchangGifts CreateExchangGifts(global::System.Int32 eG_ID)
 {
     ExchangGifts exchangGifts = new ExchangGifts();
     exchangGifts.EG_ID = eG_ID;
     return exchangGifts;
 }