public async Task <IActionResult> Get(string author, string from, string to) { if (string.IsNullOrWhiteSpace(author)) { throw new ArgumentException("Author cannot be empty"); } if (!DateTime.TryParse(from, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dtFrom) || !DateTime.TryParse(to, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dtTo)) { throw new ArgumentException("Invalid date format. Expected is dd/mm/yyyy hh:mm:ss."); } if (dtFrom > dtTo) { throw new ArgumentException("Date \"from\" should be earlier than \"to\" or equal."); } IEnumerable <string> docs = await documentProcessor.GetDocumentsAsync(author, dtFrom, dtTo); if (docs.Count() == 0) { return(NoContent()); } return(Ok(docs)); }