public ViewDispatchChalan GetDispatchChalanByDispatchId(long dispatchId) { List <ViewProduct> products = _iFactoryDeliveryGateway.GetDespatchedBarcodeByDespatchId(dispatchId).ToList(); var destination = ""; DispatchModel dispatch = GetDispatchByDispatchId(dispatchId); var viewTrip = _inventoryGateway.GetAllTrip().ToList().Find(n => n.TripId == dispatch.TripId); var details = GetDispatchDetailsByDispatchId(dispatchId); foreach (var model in details.ToList().OrderByDescending(n => n.ToBranchId).DistinctBy(n => n.ToBranchId)) { var b = _iBranchGateway.GetById(model.ToBranchId); destination += b.BranchName + "-" + b.BranchAddress + ","; } destination = destination.TrimEnd(','); var chalan = new ViewDispatchChalan { DispatchModel = dispatch, DispatchDetails = details, Destination = destination, ViewTripModel = viewTrip, Products = products }; return(chalan); }
public Branch GetById(int id) { return(_iBranchGateway.GetById(id)); }