示例#1
0
 public JsonResult Modify(Voucher model)
 {
     try
     {
         if (model.Id == 0)
         {
             model.CreateDate = DateTime.Now;
             VoucherService.InsertVoucher(model);
         }
         else
         {
             var update = VoucherService.GetVoucher(model.Id);
             update.Linked_SiteId = model.Linked_SiteId;
             update.VoucherName   = model.VoucherName;
             update.Body          = model.Body;
             update.EndDate       = model.EndDate;
             update.Flag          = model.Flag;
             VoucherService.UpdateVoucher(update);
         }
         VoucherService.Save();
         return(Json(new MessageResults {
             Status = "Success"
         }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new MessageResults {
             Status = "Error"
         }, JsonRequestBehavior.AllowGet));
     }
 }