private void FillBranchIfItIsNecessary(ReviewTransport transport) { ReviewTransportBranch branch = transport.ReviewTransportBranch; if (String.IsNullOrEmpty(branch.Description)) { TransportBranch existingBranch = this._transportService.GetTransportBranchById(transport.TransportId, branch.BranchId); branch.Description = existingBranch.Description; } this.FillOrientationIfItIsNecessary(transport); }
public TransportBranchOrientation GetTransportBranchOrientationById(int transportId, int branchId, int orientationId) { TransportBranch branch = this.GetTransportBranchById(transportId, branchId); TransportBranchOrientation orientation = branch.Orientations.FirstOrDefault(x => x.OrientationId == orientationId); if (orientation == null) { throw new ObjectNotFoundException(); } return(orientation); }
public TransportBranch GetTransportBranchById(int transportId, int branchId) { if (this._branch == null) { this._branch = this._repository.GetFirstByConditions(x => x.TransportId == transportId && x.BranchId == branchId); if (this._branch == null) { throw new ObjectNotFoundException(); } } return(this._branch); }
public ActionResult Get(int?transportId, int?branchId) { if (transportId.HasValue) { if (branchId.HasValue) { TransportBranch transportBranch = this._transportService.GetTransportBranchById(transportId.Value, branchId.Value); return(Ok(transportBranch)); } else { IList <TransportBranch> transportBranches; transportBranches = this._transportService.GetTransportBranchByTransportId(transportId.Value); return(Ok(transportBranches)); } } else { return(BadRequest()); } }