コード例 #1
0
        public ActionResult Index()
        {
            //return View(db.Contractors.ToList());
            #region List
            var _model     = db.Contractors.Include(d => d.Devices);
            var _viewModel = new List <ContractorViewModel>();

            foreach (var item in _model)
            {
                _viewModel.Add(ContractorViewModel.GetViewModelDatas(item));
            }

            return(View(_viewModel));

            #endregion // end of List
        }
コード例 #2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Contractor _model     = db.Contractors.Find(id);
            var        _viewModel = ContractorViewModel.GetViewModelDatas(_model);

            if (_model == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.DeviceID = new SelectList(db.Devices, "DeviceID", "InventoryNumber", _model.DeviceID);

            return(View(_viewModel));
        }