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); } }
public void Delete(SliderImg model) { var target = Find(model.ID); DB_Service.Remove<SliderImg>(target); DB_Service.Commit(); }
public void Create(SliderImg model) { DB_Service.Add<SliderImg>(model); DB_Service.Commit(); }
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(); }