예제 #1
0
        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));
        }
예제 #2
0
        public IHttpActionResult PostTritonExpressVehicle(TritonExpressVehicle tritonExpressVehicle)
        {
            db.TritonExpressVehicles.Add(tritonExpressVehicle);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tritonExpressVehicle.ID }, tritonExpressVehicle));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
        public IHttpActionResult GetTritonExpressVehicle(int id)
        {
            TritonExpressVehicle tritonExpressVehicle = db.TritonExpressVehicles.Find(id);

            if (tritonExpressVehicle == null)
            {
                return(NotFound());
            }

            return(Ok(tritonExpressVehicle));
        }
예제 #6
0
        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));
        }
예제 #7
0
        // 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));
        }