Esempio n. 1
0
 public ActionResult Creat(Gallery gallery)
 {
     //gallery.EncodedCatagory = EscapeUrl.UnicodeParse(gallery.EncodedCatagory);
     if (ModelState.IsValid)
     {
         dbContext.Gallerys.Add(gallery);
         dbContext.SaveChanges();
         int index = 0;
         index = dbContext.Gallerys.OrderBy(x => x.Title).ToList().IndexOf(gallery);
         return Json(index, JsonRequestBehavior.AllowGet);
     }
     return new HttpStatusCodeResult(400, "Custom Error Message 3");
 }
Esempio n. 2
0
 public ActionResult UpdateGallery(Gallery gallery)
 {
     //gallery.EncodedCatagory = EscapeUrl.UnicodeParse(gallery.EncodedCatagory);
     if (ModelState.IsValid)
     {
         dbContext.Entry(gallery).State = EntityState.Modified;
         dbContext.SaveChanges();
         return null;
     }
     else
     {
         return new HttpStatusCodeResult(400, "Custom Error Message 2");
     }
 }