public IHttpActionResult PostINSTRUCTOR(INSTRUCTOR iNSTRUCTOR) { db.INSTRUCTOR.Add(iNSTRUCTOR); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = iNSTRUCTOR.Instructor_ID }, iNSTRUCTOR)); }
public IHttpActionResult PutINSTRUCTOR(int id, INSTRUCTOR iNSTRUCTOR) { if (id != iNSTRUCTOR.Instructor_ID) { return(BadRequest()); } db.Entry(iNSTRUCTOR).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!INSTRUCTORExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { INSTRUCTOR iNSTRUCTOR = db.INSTRUCTORs.Find(id); db.INSTRUCTORs.Remove(iNSTRUCTOR); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,FULLNAME,EMAIL,ADDRES,TELEPHONE,LISENCES,GENDER,EDUCATIONAL_LEVEL")] INSTRUCTOR iNSTRUCTOR) { if (ModelState.IsValid) { db.Entry(iNSTRUCTOR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(iNSTRUCTOR)); }
public ActionResult Create([Bind(Include = "ID,FULLNAME,EMAIL,ADDRES,TELEPHONE,LISENCES,GENDER,EDUCATIONAL_LEVEL")] INSTRUCTOR iNSTRUCTOR) { if (ModelState.IsValid) { db.INSTRUCTORs.Add(iNSTRUCTOR); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(iNSTRUCTOR)); }
public IHttpActionResult GetINSTRUCTOR(int id) { INSTRUCTOR iNSTRUCTOR = db.INSTRUCTOR.Find(id); if (iNSTRUCTOR == null) { return(NotFound()); } return(Ok(iNSTRUCTOR)); }
// GET: INSTRUCTOR/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } INSTRUCTOR iNSTRUCTOR = db.INSTRUCTOR.Find(id); if (iNSTRUCTOR == null) { return(HttpNotFound()); } return(View(iNSTRUCTOR)); }
public IHttpActionResult DeleteINSTRUCTOR(int id) { INSTRUCTOR iNSTRUCTOR = db.INSTRUCTOR.Find(id); if (iNSTRUCTOR == null) { return(NotFound()); } db.INSTRUCTOR.Remove(iNSTRUCTOR); db.SaveChanges(); return(Ok(iNSTRUCTOR)); }
public ActionResult Edit([Bind(Include = "IdInstructor,Nombre,Celular1,Celular2,Estado")] INSTRUCTOR iNSTRUCTOR) { if (ModelState.IsValid) { bool existeUsuario = db.INSTRUCTOR.Any(x => x.Nombre.ToUpper() == iNSTRUCTOR.Nombre.ToUpper()); if (!existeUsuario) { db.Entry(iNSTRUCTOR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.Message = "Ya existe un registro con este nombre," + iNSTRUCTOR.Nombre + " por favor revise..."; } } return(View(iNSTRUCTOR)); }
public ActionResult Create([Bind(Include = "IdInstructor,Nombre,Celular1,Celular2,Estado")] INSTRUCTOR iNSTRUCTOR) { if (ModelState.IsValid) { bool existeUsuario = db.INSTRUCTOR.Any(x => x.Nombre.ToUpper() == iNSTRUCTOR.Nombre.ToUpper()); if (!existeUsuario) { iNSTRUCTOR.Nombre = iNSTRUCTOR.Nombre.ToUpper(); db.INSTRUCTOR.Add(iNSTRUCTOR); db.SaveChanges(); } else { ViewBag.Message = "Ya existe un registro con este nombre," + iNSTRUCTOR.Nombre + " por favor revise..."; } } return(View(iNSTRUCTOR)); }
public ActionResult INSTRUCTOR_Destroy([DataSourceRequest] DataSourceRequest request, INSTRUCTOR iNSTRUCTOR) { if (ModelState.IsValid) { var entity = new INSTRUCTOR { inst_id = iNSTRUCTOR.inst_id, inst_name = iNSTRUCTOR.inst_name, inst_phone = iNSTRUCTOR.inst_phone, inst_mail = iNSTRUCTOR.inst_mail, user_id = iNSTRUCTOR.user_id, }; db.INSTRUCTOR.Attach(entity); db.INSTRUCTOR.Remove(entity); db.SaveChanges(); } return(Json(new[] { iNSTRUCTOR }.ToDataSourceResult(request, ModelState))); }
public ActionResult INSTRUCTOR_Update([DataSourceRequest] DataSourceRequest request, INSTRUCTOR iNSTRUCTOR) { if (ModelState.IsValid) { int user = Convert.ToInt32(Session["user_id"].ToString()); var entity = new INSTRUCTOR { inst_id = iNSTRUCTOR.inst_id, inst_name = iNSTRUCTOR.inst_name, inst_phone = iNSTRUCTOR.inst_phone, inst_mail = iNSTRUCTOR.inst_mail, user_id = user, }; db.INSTRUCTOR.Attach(entity); db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); } return(Json(new[] { iNSTRUCTOR }.ToDataSourceResult(request, ModelState))); }