Пример #1
0
        public ActionResult Index()
        {
            var suppliers = supplierBll.GetAllSuppliers();
            var viewModel = suppliers.Select(s => SupplierViewModel.FromSupplier(s));

            return(View(viewModel));
        }
Пример #2
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var supplier = supplierBll.GetSupplier(id.Value);

            if (supplier == null)
            {
                return(HttpNotFound());
            }
            var viewModel = SupplierViewModel.FromSupplier(supplier);

            return(View(viewModel));
        }
Пример #3
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var supplier = supplierBll.GetSupplier(id.Value);

            if (supplier == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GroupId = new SelectList(supplierGroupBll.GetAllSupplierGroups(), "Id", "Name", supplier.Group.Id);
            var viewModel = SupplierViewModel.FromSupplier(supplier);

            return(View(viewModel));
        }