public IHttpActionResult PutLOTRINHCHOXE(int id, LOTRINHCHOXE lOTRINHCHOXE) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lOTRINHCHOXE.IDLOTRINH) { return(BadRequest()); } db.Entry(lOTRINHCHOXE).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LOTRINHCHOXEExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { LOTRINHCHOXE lOTRINHCHOXE = db.LOTRINHCHOXEs.Find(id); db.LOTRINHCHOXEs.Remove(lOTRINHCHOXE); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult GetLOTRINHCHOXE(int id) { LOTRINHCHOXE lOTRINHCHOXE = db.LOTRINHCHOXEs.Find(id); if (lOTRINHCHOXE == null) { return(NotFound()); } return(Ok(lOTRINHCHOXE)); }
public IHttpActionResult PostLOTRINHCHOXE(LOTRINHCHOXE lOTRINHCHOXE) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LOTRINHCHOXEs.Add(lOTRINHCHOXE); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = lOTRINHCHOXE.IDLOTRINH }, lOTRINHCHOXE)); }
public IHttpActionResult DeleteLOTRINHCHOXE(int id) { LOTRINHCHOXE lOTRINHCHOXE = db.LOTRINHCHOXEs.Find(id); if (lOTRINHCHOXE == null) { return(NotFound()); } db.LOTRINHCHOXEs.Remove(lOTRINHCHOXE); db.SaveChanges(); return(Ok(lOTRINHCHOXE)); }
// GET: LoTrinhChoXe/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LOTRINHCHOXE lOTRINHCHOXE = db.LOTRINHCHOXEs.Find(id); if (lOTRINHCHOXE == null) { return(HttpNotFound()); } return(View(lOTRINHCHOXE)); }
public ActionResult Edit(AllModel lOtrinhchoxe) { var tblLotrinh = new LOTRINHCHOXE(); tblLotrinh.CAM = lOtrinhchoxe.Cam == "0" ? false :true; tblLotrinh.KICHHOAT = lOtrinhchoxe.KichHoat == "0" ? false : true; tblLotrinh.IDTUYEN = lOtrinhchoxe.TblLoTrinhXe.IDTUYEN; tblLotrinh.MATAIXE = lOtrinhchoxe.TblLoTrinhXe.MATAIXE; tblLotrinh.MAXE = lOtrinhchoxe.TblLoTrinhXe.MAXE; tblLotrinh.IDLOTRINH = lOtrinhchoxe.TblLoTrinhXe.IDLOTRINH; db.Entry(tblLotrinh).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: LoTrinhChoXe/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LOTRINHCHOXE lOTRINHCHOXE = db.LOTRINHCHOXEs.Find(id); if (lOTRINHCHOXE == null) { return(HttpNotFound()); } var all = new AllModel { ListDmXe = db.DMXEs.ToList(), ListDMTUYEN = db.DMTUYENs.ToList(), ListDmTaiXe = db.DMTAIXEs.ToList(), TblLoTrinhXe = lOTRINHCHOXE, Cam = lOTRINHCHOXE.CAM == true ?"1":"0", KichHoat = lOTRINHCHOXE.KICHHOAT == true ?"1":"0", }; return(View(all)); }