public async Task <TorrentsViewModel> GetTorrentsAsync(SearchAndFilterCriteria criteria, int?pageIndex) { if (criteria == null) { throw new AppException(ExceptionEvent.InvalidParameters, "Criteria can't be null."); } if (pageIndex.HasValue && pageIndex.Value < 0) { throw new AppException(ExceptionEvent.InvalidParameters, "Page can't be negative."); } return(await _customHttpClient.PostJsonAsync <TorrentsViewModel>($"api/Torrents/GetTorrents/?pageIndex={pageIndex}", criteria)); }
static void Main() { Task.Run(async() => { var baseAddress = IsDevelopment ? "http://*****:*****@gmail.com" }); if (!jsonResponse.IsSuccessStatusCode) { Console.WriteLine(jsonResponse.StatusCode); } else { var content = await jsonResponse.Content.ReadAsStringAsync(); var jsonObject = await client.ReadAsJsonAsync <ResultModel>(jsonResponse.Content); if (jsonObject.IsSuccess) { Console.WriteLine(content); } } Console.ReadKey(); }).Wait(); Console.ReadKey(); }
public async Task Register(RegistrationViewModel registrationViewModel) { await _customHttpClient.PostJsonAsync("api/account/register", registrationViewModel ?? throw new AppException(ExceptionEvent.InvalidParameters, "Registration form can't be empty.")); }