Exemplo n.º 1
0
        public ActionResult AddDiscount(DiscountInfoAddViewModel discountInfo)
        {
            if (!ModelState.IsValid)
                return AddDiscount();
            //
            discountInfo.CreateTime = DateTime.Now;
            discountInfo.PublishTime = DateTime.Now;
            discountInfo.CreateUserName = this.UserNikename;
            discountInfo.CreateUserId = this.UserId;
            discountInfo.Published = true;
            discountInfo.Audited = true;
            int id = 0;
            try
            {
                id = DiscountService.SaveDiscountInfo(AutoMapperUtility.Map<DiscountInfoAddViewModel, DiscountInfo>(discountInfo));
            }
            catch (Exception exception)
            {

                throw;
            }

            if (id != 0)
                return RedirectToAction("DiscountDetail", "Home", new {id = id});
            return AddDiscount();
        }
Exemplo n.º 2
0
 public ActionResult AddDiscount()
 {
     DiscountInfoAddViewModel discountInfo = new DiscountInfoAddViewModel();
     return View(discountInfo);
 }