/// <summary> /// From Partner Pivot To Partner Dto. /// </summary> /// <param name="partnerPivot">partner pivot to assemble.</param> /// <returns>PartnerDto result.</returns> public static PartnerDto ToDto(this PartnerPivot partnerPivot) { if (partnerPivot == null) { return(null); } return(new PartnerDto() { PartnerId = partnerPivot.PartnerId, PartnerImage = partnerPivot.PartnerImage, PartnerName = partnerPivot.PartnerName, PartnerLink = partnerPivot.PartnerLink, PartnerPosition = partnerPivot.PartnerPosition, }); }
/// <summary> /// Search Partner by id. /// </summary> /// <param name="request">The Partner Request Pivot to retrive.</param> /// <returns>Partner Response Pivot response.</returns> public PartnerResponsePivot FindPartners(PartnerRequestPivot request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } List <PartnerPivot> results = new List <PartnerPivot>(); PartnerPivot result = new PartnerPivot(); switch (request.FindPartnerPivot) { case FindPartnerPivot.PartnerId: result = _unitOfWork.PartnerRepository.GetById(request.PartnerPivot.PartnerId)?.ToPivot(); break; } return(new PartnerResponsePivot() { PartnerPivotList = results, PartnerPivot = result }); }