public List <ViewRequestDetail> ViewRequestDetail(int id) { using (StationeryStoreEntities context = new StationeryStoreEntities()) { List <RequestDetail> r = context.RequestDetails.Where(x => x.RequestID == id).ToList(); //View List of RequestDetail List <ViewRequestDetail> rc = new List <ViewRequestDetail>(); for (int i = 0; i < r.Count; i++) { ViewRequestDetail rdc = new ViewRequestDetail(r[i].RequestDetailID, r[i].CatalogueInventory.Item_Description, r[i].Qty, r[i].CatalogueInventory.UnitCost, r[i].CatalogueInventory.UnitCost * r[i].Qty); rc.Add(rdc); } return(rc); }; }
//4. View not submitted list -- tested public static List <ViewRequestDetail> ViewNotSubmittedRequestDetail(int id) { using (StationeryStoreEntities context = new StationeryStoreEntities()) { //int id = e.EmployeeID; List <RequestDetail> r = context.RequestDetail.Where(x => x.EmployeeID == id && x.RequestID == null).ToList(); //RequestID is null when request is not submitted List <ViewRequestDetail> rc = new List <ViewRequestDetail>(); for (int i = 0; i < r.Count; i++) { ViewRequestDetail rdc = new ViewRequestDetail(r[i].RequestDetailID, r[i].CatalogueInventory.Item_Description, r[i].Qty, r[i].CatalogueInventory.UnitOfMeasure, r[i].CatalogueInventory.UnitCost, r[i].CatalogueInventory.UnitCost * r[i].Qty); rc.Add(rdc); } return(rc); } }