Пример #1
0
 public ActionResult Creat(SliderHome sliderHome)
 {
     if (ModelState.IsValid)
     {
         dbContext.SliderHomes.Add(sliderHome);
         dbContext.SaveChanges();
         int index = 0;
         index = dbContext.SliderHomes.OrderBy(x => x.Title).ToList().IndexOf(sliderHome);
         return Json(index, JsonRequestBehavior.AllowGet);
     }
     return new HttpStatusCodeResult(400, "Custom Error Message 2");
 }
Пример #2
0
 public ActionResult UpdateSliderHome(SliderHome sliderHome)
 {
     if (ModelState.IsValid)
     {
         dbContext.Entry(sliderHome).State = EntityState.Modified;
         dbContext.SaveChanges();
         return null;
     }
     else
     {
         return new HttpStatusCodeResult(400, "Custom Error Message 2");
     }
 }