public async Task <IActionResult> Edit(int id, [Bind("ID,branch,vehicleyear,vehiclemake,vehiclemodel,vehiclereg,wayBillID")] TritonExpressVehicle tritonExpressVehicle) { if (id != tritonExpressVehicle.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tritonExpressVehicle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TritonExpressVehicleExists(tritonExpressVehicle.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tritonExpressVehicle)); }
public IHttpActionResult PostTritonExpressVehicle(TritonExpressVehicle tritonExpressVehicle) { db.TritonExpressVehicles.Add(tritonExpressVehicle); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tritonExpressVehicle.ID }, tritonExpressVehicle)); }
public IHttpActionResult PutTritonExpressVehicle(int id, TritonExpressVehicle tritonExpressVehicle) { if (id != tritonExpressVehicle.ID) { return(BadRequest()); } db.Entry(tritonExpressVehicle).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TritonExpressVehicleExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Create([Bind("ID,branch,vehicleyear,vehiclemake,vehiclemodel,vehiclereg,wayBillID")] TritonExpressVehicle tritonExpressVehicle) { if (ModelState.IsValid) { _context.Add(tritonExpressVehicle); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tritonExpressVehicle)); }
public IHttpActionResult GetTritonExpressVehicle(int id) { TritonExpressVehicle tritonExpressVehicle = db.TritonExpressVehicles.Find(id); if (tritonExpressVehicle == null) { return(NotFound()); } return(Ok(tritonExpressVehicle)); }
public IHttpActionResult DeleteTritonExpressVehicle(int id) { TritonExpressVehicle tritonExpressVehicle = db.TritonExpressVehicles.Find(id); if (tritonExpressVehicle == null) { return(NotFound()); } db.TritonExpressVehicles.Remove(tritonExpressVehicle); db.SaveChanges(); return(Ok(tritonExpressVehicle)); }
// GET: TritonExpressVehicles/Create public IActionResult Create() { TritonExpressVehicle model = new TritonExpressVehicle(); model.branch = "Select"; List <TritonExpressWaybill> tritonwaybillList = new List <TritonExpressWaybill>(); tritonwaybillList = (from waybill in _context.TritonExpressWaybill select waybill).ToList(); tritonwaybillList.Insert(0, new TritonExpressWaybill { wayBillID = 0, RecipientName = "Select" }); ViewBag.ListOfWaybill = tritonwaybillList; return(View(model)); }