public ActionResult Create(Colegio colegio)
        {
            if (ModelState.IsValid)
            {
                db.Colegio.Add(colegio);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(colegio);
        }
        public JsonResult Colegio(int? id, Colegio item)
        {
            switch (Request.HttpMethod)
            {
                case "POST":
                    return Json(InsertarColegios(item));
                case "PUT":
                  //  return Json(ActualizarColegios(item));
                case "GET":
                   return Json(ObtenerColegio(id.GetValueOrDefault()),
                               JsonRequestBehavior.AllowGet);
                case "DELETE":
                    return Json(EliminarColegios(id.GetValueOrDefault()));
            }

            return Json(new { Error = true, Message = "Operación HTTP desconocida" });
        }
 public bool InsertarColegios(Colegio colegio)
 {
     if (ModelState.IsValid)
     {
         db.Colegio.Add(colegio);
         db.SaveChanges();
         return true;
     }
     else
     {
         return false;
     }
 }
 public ActionResult Edit(Colegio colegio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(colegio).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(colegio);
 }