public HttpResponseMessage Create(OtherCouponModel model)
 {
     Random random = new Random();
     int num = random.Next(10000000, 100000000);
     var coupon = new global::Event.Entity.Entity.OtherCoupon.OtherCoupon
     {
         Number = num.ToString(),
         Price = model.Price,
         Status = model.Status,
         CouponCategoryId = model.CouponCategoryId
     };
     if (_otherCouponService.Create(coupon) != null)
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功"));
     }
     return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败"));
 }
 public HttpResponseMessage BlukCreate(OtherCouponModel model)
 {
     Random random = new Random();
     List<global::Event.Entity.Entity.OtherCoupon.OtherCoupon> list = new List<global::Event.Entity.Entity.OtherCoupon.OtherCoupon>();
     for (int i = 0; i < model.Count; i++)
     {
         list.Add(new global::Event.Entity.Entity.OtherCoupon.OtherCoupon
         {
             Number = DateTime.Now.ToString("HHmmss") + random.Next(10000000, 100000000),
             Price = model.Price,
             Status = model.Status,
             CouponCategoryId = model.CouponCategoryId
         });
     }
     if (_otherCouponService.BulkCreate(list))
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功"));
     }
     return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败"));
 }
 public HttpResponseMessage Edit(OtherCouponModel model)
 {
     var coupon = _otherCouponService.GetCouponById(model.Id);
     coupon.Number = model.Number;
     coupon.Price = model.Price;
     coupon.Status = model.Status;
     coupon.CouponCategoryId = model.CouponCategoryId;
     if (_otherCouponService.Update(coupon) != null)
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功"));
     }
     return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败"));
 }