Esempio n. 1
0
        // GET: NcrChinas/Edit/5
        public ActionResult Edit(int?id)
        {
            var ncrChinas = db.NcrChinas.SingleOrDefault(c => c.NcrChinaId == id);

            var customers         = db.Customers.ToList();
            var customerdivisions = db.CustomerDivisions.ToList();
            var dispositions      = db.Dispositions.ToList();
            var mlsdivisions      = db.MlsDivisions.ToList();
            var statuses          = db.Statuses.ToList();
            var ncrtypes          = db.NcrTypes.ToList();

            var viewModel = new SaveNcrChinaViewModel()
            {
                NcrChina          = ncrChinas,
                Customers         = customers,
                CustomerDivisions = customerdivisions,
                Dispositions      = dispositions,
                MlsDivisions      = mlsdivisions,
                Statuses          = statuses,
                NcrTypes          = ncrtypes
            };

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NcrChina ncrChina = db.NcrChinas.Find(id);

            if (ncrChina == null)
            {
                return(HttpNotFound());
            }
            return(View("Edit", viewModel));
        }
Esempio n. 2
0
        // GET: NcrChinas/Create
        public ActionResult Create()
        {
            var customers         = db.Customers.ToList();
            var customerdivisions = db.CustomerDivisions.ToList();
            var dispositions      = db.Dispositions.ToList();
            var mlsdivisions      = db.MlsDivisions.ToList();
            var statuses          = db.Statuses.ToList();
            var ncrtypes          = db.NcrTypes.ToList();

            var viewModel = new SaveNcrChinaViewModel()
            {
                Customers         = customers,
                CustomerDivisions = customerdivisions,
                Dispositions      = dispositions,
                MlsDivisions      = mlsdivisions,
                Statuses          = statuses,
                NcrTypes          = ncrtypes
            };

            return(View(viewModel));
        }