Beispiel #1
0
        public ActionResult Create(SliderImgViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {

                    for (var i = 0; i < model.Day; i++)
                    {
                        var topTime = model.StartTime.AddDays(i);
                        SliderImg item = new SliderImg()
                        {
                            AddTime = DateTime.Now,
                            TopTime = topTime,
                            ImgUrl = model.ImgUrl,
                            LinkUrl = model.LinkUrl,
                            MemberID = CookieHelper.MemberID,
                            Status = model.SliderImgStatus,
                            ProvinceCode = model.ProvinceCode,
                            OrderIndex = model.OrderIndex,
                            Title = model.Name
                        };
                        SliderImgService.Create(item);

                    }

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

            }
            else
            {
                return View(model);
            }
        }
Beispiel #2
0
 public void Delete(SliderImg model)
 {
     var target = Find(model.ID);
     DB_Service.Remove<SliderImg>(target);
     DB_Service.Commit();
 }
Beispiel #3
0
 public void Create(SliderImg model)
 {
     DB_Service.Add<SliderImg>(model);
     DB_Service.Commit();
 }
Beispiel #4
0
 public void Update(SliderImg model)
 {
     var target = Find(model.ID);
     DB_Service.Attach<SliderImg>(target);
     target.Title = model.Title;
     target.ImgUrl = model.ImgUrl;
     target.MemberID = model.MemberID;
     target.OrderIndex = model.OrderIndex;
     target.ProvinceCode = model.ProvinceCode;
     target.Status = model.Status;
     target.TopTime = model.TopTime;
     target.LinkUrl = model.LinkUrl;
     DB_Service.Commit();
 }