Example #1
0
        // GET: ShipOuts/Edit/5
        public ActionResult Edit(int?id)
        {
            var shipouts = db.ShipOuts.SingleOrDefault(c => c.ShipOutId == id);

            var customers         = db.Customers.ToList();
            var customerdivisions = db.CustomerDivisions.ToList();
            var freighttypes      = db.FreightTypes.ToList();
            var fpaymentmethods   = db.FPaymentMethods.ToList();

            var viewModel = new SaveShipOutViewModel()
            {
                ShipOut           = shipouts,
                Customers         = customers,
                CustomerDivisions = customerdivisions,
                FreightTypes      = freighttypes,
                FPaymentMetods    = fpaymentmethods
            };

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShipOut shipOut = db.ShipOuts.Find(id);

            if (shipOut == null)
            {
                return(HttpNotFound());
            }
            return(View("Edit", viewModel));
        }
Example #2
0
        public IHttpActionResult PutShipOut(int id, ShipOut shipOut)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != shipOut.ShipOutId)
            {
                return(BadRequest());
            }

            db.Entry(shipOut).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ShipOutExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            ShipOut shipOut = db.ShipOuts.Find(id);

            db.ShipOuts.Remove(shipOut);
            db.SaveChanges();
            return(RedirectToAction("Index", "ShipIns"));
        }
Example #4
0
 //public ActionResult Edit([Bind(Include = "ShipOutId,CustomerId,CustomerDivisionId,FreightTypeId,FPaymentMethodId,Carrier,TrackingInfo,Destination,Quote,SoldTo,ShipTo,ShipCity,ShipState,ShipZip,ShipDescription,ShipWeight,ManifestNo,PoNumber,SoNumber,PalletNo,Pn,Sn,ShipDate,Quantity")] ShipOut shipOut)
 public ActionResult Edit(ShipOut shipOut)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipOut).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "ShipIns"));
     }
     return(View());
 }
Example #5
0
        public IHttpActionResult GetShipOut(int id)
        {
            ShipOut shipOut = db.ShipOuts.Find(id);

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

            return(Ok(shipOut));
        }
Example #6
0
        public IHttpActionResult PostShipOut(ShipOut shipOut)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ShipOuts.Add(shipOut);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = shipOut.ShipOutId }, shipOut));
        }
Example #7
0
        //public ActionResult Create([Bind(Include = "ShipOutId,CustomerId,CustomerDivisionId,FreightTypeId,FPaymentMethodId,Carrier,TrackingInfo,Destination,Quote,SoldTo,ShipTo,ShipCity,ShipState,ShipZip,ShipDescription,ShipWeight,ManifestNo,PoNumber,SoNumber,PalletNo,Pn,Sn,ShipDate,Quantity")] ShipOut shipOut)
        public ActionResult Create(ShipOut shipOut)
        {
            if (ModelState.IsValid)
            {
                db.ShipOuts.Add(shipOut);
                db.SaveChanges();
                return(RedirectToAction("Index", "ShipIns"));
            }

            return(View());
            //return View(shipOut);
        }
Example #8
0
        public IHttpActionResult DeleteShipOut(int id)
        {
            ShipOut shipOut = db.ShipOuts.Find(id);

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

            db.ShipOuts.Remove(shipOut);
            db.SaveChanges();

            return(Ok(shipOut));
        }
Example #9
0
        // GET: ShipOuts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShipOut shipOut = db.ShipOuts.Find(id);

            if (shipOut == null)
            {
                return(HttpNotFound());
            }
            return(View(shipOut));
        }