Example #1
0
        public ActionResult Create(ServerItemViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ServerItem item = new ServerItem()
                    {
                        AddTime = DateTime.Now,
                        Description = model.Description,
                        EndTime = model.EndTime,
                        GiftMoney = model.GiftMoney,
                        GiftMonth = model.GiftMonth,
                        ImgUrl = model.ImgUrl,
                        HelpUrl = model.HelpUrl,
                        IsPayByVMoney = model.IsPayByVMoney,
                        IsByCategory = model.IsByCategory,
                        IsByChildCategory = model.IsByChildCategory,
                        IsQuanGuo = model.IsQuanGuo,
                        LastTime = DateTime.Now,
                        MemberID = CookieHelper.MemberID,
                        Money = model.Money,
                        Month = model.Month,
                        Name = model.Name,
                        Price = model.Price,
                        ServerType = model.ServerType,
                        TopType = model.TopType,
                        VipDiscount = model.VipDiscount,
                        VipDiscount2 = model.VipDiscount2
                    };
                    ServerItemService.Create(item);

                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    return View(model);
                }

            }
            else
            {
                return View(model);
            }
        }
Example #2
0
 public ActionResult Edit(int id)
 {
     var item = ServerItemService.Find(id);
     var model = new ServerItemViewModel()
     {
         VipDiscount2 = item.VipDiscount2,
         VipDiscount = item.VipDiscount,
         ServerType = item.ServerType,
         TopType = item.TopType,
         Price = item.Price,
         Name = item.Name,
         Month = item.Month,
         IsQuanGuo = item.IsQuanGuo,
         IsByCategory = item.IsByCategory,
         IsByChildCategory = item.IsByChildCategory,
         Money = item.Money,
         IsPayByVMoney = item.IsPayByVMoney,
         HelpUrl = item.HelpUrl,
         ImgUrl = item.ImgUrl,
         GiftMonth = item.GiftMonth,
         Description = item.Description,
         EndTime = item.EndTime,
         GiftMoney = item.GiftMoney,
         ID = item.ID
     };
     return View(model);
 }
Example #3
0
 public ActionResult Create()
 {
     var model = new ServerItemViewModel();
     return View(model);
 }