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