using BS.Shared.DataContracts; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BS.Shared.ReportRequests { public abstract class AbstractReportRequest { public ReportTypes ReportType { get; set; } public AbstractReportRequest(ReportTypes type) { ReportType = type; } internal abstract NameValueCollection GetParameters(); public string GetUrlPathString() { var sb = new StringBuilder(); sb.Append($"?type={ReportType}"); var parameters = GetParameters(); if (parameters is null) return sb.ToString(); foreach (string key in parameters) { var value = parameters[key]; sb.Append($"&{key}={value}"); } return sb.ToString(); } } }