public ActionResult Index() { var suppliers = supplierBll.GetAllSuppliers(); var viewModel = suppliers.Select(s => SupplierViewModel.FromSupplier(s)); return(View(viewModel)); }
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)); }
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)); }