Exemple #1
0
        // GET: ViewStatus
        public ActionResult Index()
        {
            List <ShipView> ShipView = new List <ShipView>();

            using (CMS_modelContainer context = new CMS_modelContainer())
            {
                ShipView = context.ShipViews.ToList();
            }

            return(View(ShipView));
        }
Exemple #2
0
        public ActionResult DeleteStatus(int id)
        {
            var ShipView = new ShipView();

            using (CMS_modelContainer context = new CMS_modelContainer())
            {
                ShipView = context.ShipViews.Where(b => b.Ship_Id == id).FirstOrDefault();
                context.ShipViews.Remove(ShipView);
                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult EditStatus(EditShipViewModel b)
        {
            using (CMS_modelContainer context = new CMS_modelContainer())
            {
                var shipView = context.ShipViews.Single(e => e.Ship_Id == b.Ship_Id);

                shipView.Ship_Id      = b.Ship_Id;
                shipView.Ship_Place   = b.Ship_Place;
                shipView.Ship_Depart  = b.Ship_Depart;
                shipView.Ship_Arrived = b.Ship_Arrived;
                shipView.Status       = b.Status;
                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult Add_New(ShipView svs)
        {
            using (CMS_modelContainer context = new CMS_modelContainer())
            {
                var shipView = new ShipView();

                shipView.Ship_Place   = svs.Ship_Place;
                shipView.Ship_Depart  = svs.Ship_Depart;
                shipView.Ship_Arrived = svs.Ship_Arrived;
                shipView.Status       = "Pending";

                context.ShipViews.Add(shipView);
                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Exemple #5
0
        public ActionResult EditStatus(int id)
        {
            var shipView = new ShipView();

            EditShipViewModel esvm = new EditShipViewModel();

            using (CMS_modelContainer context = new CMS_modelContainer())
            {
                shipView          = context.ShipViews.Where(b => b.Ship_Id == id).FirstOrDefault();
                esvm.Ship_Id      = shipView.Ship_Id;
                esvm.Ship_Place   = shipView.Ship_Place;
                esvm.Ship_Depart  = shipView.Ship_Depart;
                esvm.Ship_Arrived = shipView.Ship_Arrived;
                esvm.Status       = shipView.Status;
            }
            esvm.listItem = new List <SelectListItem>();
            loadList(esvm.listItem);
            return(View(esvm));
        }