public ActionResult ViewShipmentsByProducer(long ProducerID) { ShipmentVM newVM = new ShipmentVM(); if (Session["UserName"] != null && (int)Session["UserLevel"] <= 2) { try { //call to db to get ships by loc, then map list data to presentation list obj. List <IShipmentInfoDO> shipmentData = _ShipmentAccess.ViewShipmentsByProducer(ProducerID); newVM.ShipmentList = ShipmentMap.MapDOtoPO(shipmentData); } catch (Exception) { newVM.ErrorMessage = "There was an issue obtaining the list"; } finally { ///nothing else needs to happen } } else { RedirectToAction("Login", "User"); } return(View(newVM)); }
public ActionResult ViewShipments() { ActionResult oResponse = null; ShipmentVM newVM = new ShipmentVM(); if (Session["UserName"] != null && ((int)Session["UserLevel"] == 2 || (int)Session["UserLevel"] == 1)) { try { //call to db to obtain all shipments, then map list data to presentation list obj. List <IShipmentInfoDO> shipmentData = _ShipmentAccess.ViewAllShipments(); newVM.ShipmentList = ShipmentMap.MapDOtoPO(shipmentData); } catch (Exception) { newVM.ErrorMessage = "There was an issue obtaining the list"; } finally { oResponse = View(newVM); } } else { oResponse = RedirectToAction("Login", "User"); } return(oResponse); }
public ActionResult UpdateShipment(long ShipmentID) { ShipmentVM updateVM = new ShipmentVM(); if (Session["UserName"] != null && (int)Session["UserLevel"] <= 2) { IShipmentInfoDO shipment = _ShipmentAccess.ViewShipmentByID(ShipmentID); updateVM.Shipment = ShipmentMap.MapDOtoPO(shipment); //call to data layer method to get list of producers for drop down updateVM.Shipment.LocationDDL = PopulateLocationsDDL(); updateVM.Shipment.ProducerDDL = PopulateProducersDDL(); } else { RedirectToAction("Login", "User"); } return(View(updateVM)); }