Exemplo n.º 1
0
        public ActionResult EditInactiveTrailer([Bind(Include = "TrailerNumber,DOTDate,TrailerStatus,Leased,InsuranceCard,Insured,Title,PlateNumber,VinNumber,Manufacturer,ManufactureYear,TrailerLength,Issues,Tags,DateModified")] InactiveTrailerList UpdatedTrailer)
        {
            using (TrailerEntities db = new TrailerEntities())
            {
                InactiveTrailerList trailer = db.InactiveTrailerLists.FirstOrDefault(t => t.TrailerNumber == UpdatedTrailer.TrailerNumber);

                trailer.TrailerNumber   = UpdatedTrailer.TrailerNumber;
                trailer.DOTDate         = UpdatedTrailer.DOTDate;
                trailer.TrailerStatus   = UpdatedTrailer.TrailerStatus;
                trailer.Leased          = UpdatedTrailer.Leased;
                trailer.InsuranceCard   = UpdatedTrailer.InsuranceCard;
                trailer.Insured         = UpdatedTrailer.Insured;
                trailer.Title           = UpdatedTrailer.Title;
                trailer.PlateNumber     = UpdatedTrailer.PlateNumber;
                trailer.VinNumber       = UpdatedTrailer.VinNumber;
                trailer.Manufacturer    = UpdatedTrailer.Manufacturer;
                trailer.ManufactureYear = UpdatedTrailer.ManufactureYear;
                trailer.TrailerLocation = UpdatedTrailer.TrailerLocation;
                trailer.TrailerLength   = UpdatedTrailer.TrailerLength;
                trailer.Issues          = UpdatedTrailer.Issues;
                trailer.DateModified    = UpdatedTrailer.DateModified;
                db.SaveChanges();
                return(RedirectToAction(actionName: "InactiveTrailerList", controllerName: "Trailer"));
            }
        }
Exemplo n.º 2
0
        public ActionResult CreateInactiveTrailer(string trailerNumber)
        {
            if (Session["username"] == null)
            {
                return(RedirectToAction(actionName: "SignIn", controllerName: "Users"));
            }
            else
            {
                using (TrailerEntities db = new TrailerEntities())
                {
                    if (Convert.ToInt32(Session["permission"]) < constant.PERMISSION_EDIT)
                    {
                        return(RedirectToAction(actionName: "InsufficientPermissions", controllerName: "Error"));
                    }
                    else
                    {
                        TrailerList trailer = db.TrailerLists.FirstOrDefault(t => t.TrailerNumber == trailerNumber);

                        InactiveTrailerList trailerEdit = new InactiveTrailerList()
                        {
                            TrailerNumber   = trailer.TrailerNumber,
                            DOTDate         = trailer.DOTDate,
                            TrailerStatus   = trailer.TrailerStatus,
                            Leased          = trailer.Leased,
                            InsuranceCard   = trailer.InsuranceCard,
                            Insured         = trailer.Insured,
                            Title           = trailer.Title,
                            PlateNumber     = trailer.PlateNumber,
                            VinNumber       = trailer.VinNumber,
                            Manufacturer    = trailer.Manufacturer,
                            ManufactureYear = trailer.ManufactureYear,
                            TrailerLength   = trailer.TrailerLength,
                            Issues          = trailer.Issues,
                            DateModified    = trailer.DateModified
                        };
                        db.InactiveTrailerLists.Add(trailerEdit);
                        db.SaveChanges();
                        return(RedirectToAction(actionName: "RemoveFromMasterList", controllerName: "Trailer", routeValues: new { trailerNumber }));
                    }
                }
            }
        }
Exemplo n.º 3
0
        public ActionResult EditInactiveTrailer(string trailerNumber)
        {
            if (Session["username"] == null)
            {
                return(RedirectToAction(actionName: "SignIn", controllerName: "Users"));
            }
            else
            {
                if (Convert.ToInt32(Session["permission"]) < constant.PERMISSION_MANAGER)
                {
                    return(RedirectToAction(actionName: "InsufficientPermissions", controllerName: "Error"));
                }
                else
                {
                    using (TrailerEntities db = new TrailerEntities())
                    {
                        InactiveTrailerList trailer = db.InactiveTrailerLists.FirstOrDefault(t => t.TrailerNumber == trailerNumber);

                        return(View(trailer));
                    }
                }
            }
        }