CalMonthServices.cs 958 B

123456789101112131415161718192021222324252627282930313233343536
  1. using Blazored.LocalStorage;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Net.Http;
  6. using System.Net.Http.Json;
  7. using System.Threading.Tasks;
  8. using wispro.sp.entity;
  9. namespace wispro.sp.web.Services
  10. {
  11. public class CalMonthServices
  12. {
  13. private readonly HttpClient _httpClient;
  14. private readonly ILocalStorageService _localStorageService;
  15. public CalMonthServices(HttpClient httpClient)
  16. {
  17. _httpClient = httpClient;
  18. }
  19. public async Task<CalMonth> GetHandlingMonth()
  20. {
  21. try
  22. {
  23. var data = await _httpClient.GetFromJsonAsync<CalMonth>($"http://localhost:39476/api/CalMonth/GetHandlingMonth");
  24. return data;
  25. }
  26. catch(Exception ex)
  27. {
  28. Console.WriteLine(ex.ToString());
  29. return null;
  30. }
  31. }
  32. }
  33. }