public ActionResult Create() { var plan = new PLANES(); plan.EstatusList = new SelectList(_db.ESTATUS.ToList(), "Id", "Estatus1"); return(View(plan)); }
public IHttpActionResult PostPLANES(PLANES pLANES) { pLANES.FECHAMOD = DateTime.Now; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PLANES.Add(pLANES); try { db.SaveChanges(); } catch (DbUpdateException) { if (PLANESExists(pLANES.IDPLAN)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pLANES.IDPLAN }, pLANES)); }
public IHttpActionResult PutPLANES(int id, PLANES pLANES) { pLANES.FECHAMOD = DateTime.Now; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pLANES.IDPLAN) { return(BadRequest()); } db.Entry(pLANES).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PLANESExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPLANES(int id) { PLANES pLANES = db.PLANES.Find(id); if (pLANES == null) { return(NotFound()); } return(Ok(pLANES)); }
public ActionResult Edit(PLANES plan) { if (!ModelState.IsValid) { return(RedirectToAction(nameof(Index))); } _db.Entry(plan).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction(nameof(Index))); }
public ActionResult Create(PLANES plan) { if (!ModelState.IsValid) { return(RedirectToAction(nameof(Index))); } _db.PLANES.Add(plan); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); }
public IHttpActionResult DeletePLANES(int id) { PLANES pLANES = db.PLANES.Find(id); if (pLANES == null) { return(NotFound()); } db.PLANES.Remove(pLANES); db.SaveChanges(); return(Ok(pLANES)); }