Beispiel #1
0
 public ActionResult Creat(Partner partner)
 {
     if (ModelState.IsValid) {
     dbContext.Partners.Add(partner);
     dbContext.SaveChanges();
     int index = 0;
     index = dbContext.Partners.OrderBy(x => x.Name).ToList().IndexOf(partner);
     return Json(index,JsonRequestBehavior.AllowGet);
     }
     return new HttpStatusCodeResult(400, "Custom Error Message 2");
 }
Beispiel #2
0
 public ActionResult UpdatePartner(Partner partner)
 {
     if (ModelState.IsValid)
     {
         dbContext.Entry(partner).State = EntityState.Modified;
         dbContext.SaveChanges();
         return null;
     }
     else
     {
         return new HttpStatusCodeResult(400, "Custom Error Message 2");
     }
 }