diff --git a/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs b/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs index ff63b39f7f0e0c2aca51014442d273565911a38e..f75862f88305781bdd61282571562258c17e6a5a 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs @@ -56,14 +56,9 @@ namespace Tsi1.BusinessLayer.DataLoad public async Task<ServiceResult<bool>> LoadCoursesInBedelia() { - var courses = await _context.Courses.Select(x => - new CourseCreateBedeliaDto() - { - Name = x.Name - }) - .ToListAsync(); + var courseNames = await _context.Courses.Select(x => x.Name).ToListAsync(); - return await _bedeliaService.CreateCourses(courses); + return await _bedeliaService.CreateCourses(courseNames); } public async Task LoadDataAsync() diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Dtos/CourseCreateBedeliaDto.cs b/Tsi1.Api/Tsi1.BusinessLayer/Dtos/CourseCreateBedeliaDto.cs deleted file mode 100644 index 5897c34e4c61e4c53166832477411d21fe1adc14..0000000000000000000000000000000000000000 --- a/Tsi1.Api/Tsi1.BusinessLayer/Dtos/CourseCreateBedeliaDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Tsi1.BusinessLayer.Dtos -{ - public class CourseCreateBedeliaDto - { - public string Name { get; set; } - } -} diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Interfaces/IBedeliaService.cs b/Tsi1.Api/Tsi1.BusinessLayer/Interfaces/IBedeliaService.cs index 1a159dbe04dba842753442fcd68b6303da49f555..63e4db8741b6e1751e47cbfc9df56683001b65ec 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/Interfaces/IBedeliaService.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/Interfaces/IBedeliaService.cs @@ -15,6 +15,6 @@ namespace Tsi1.BusinessLayer.Interfaces Task<ServiceResult<bool>> Login(string identityCard, string password); Task<ServiceResult<bool>> IsValidCourse(string courseName); Task<ServiceResult<bool>> CreateUsers(List<UserCreateBedeliaDto> users); - Task<ServiceResult<bool>> CreateCourses(List<CourseCreateBedeliaDto> users); + Task<ServiceResult<bool>> CreateCourses(List<string> courseNames); } } diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Services/BedeliaService.cs b/Tsi1.Api/Tsi1.BusinessLayer/Services/BedeliaService.cs index 94531055c440ed6be620a16087b8538013b920fe..da77b6ffd7dd0fe8510d070d3fb5c247ed6d9735 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/Services/BedeliaService.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/Services/BedeliaService.cs @@ -104,7 +104,7 @@ namespace Tsi1.BusinessLayer.Services var jsonInString = JsonConvert.SerializeObject(users); var model = new StringContent(jsonInString, Encoding.UTF8, "application/json"); - var response = await _httpClient.PostAsync("api/Users", model); + var response = await _httpClient.PostAsync("api/Users/loadData", model); if (response.StatusCode != HttpStatusCode.OK) { result.HasError = true; @@ -115,14 +115,14 @@ namespace Tsi1.BusinessLayer.Services return result; } - public async Task<ServiceResult<bool>> CreateCourses(List<CourseCreateBedeliaDto> courses) + public async Task<ServiceResult<bool>> CreateCourses(List<string> courseNames) { var result = new ServiceResult<bool>(); - var jsonInString = JsonConvert.SerializeObject(courses); + var jsonInString = JsonConvert.SerializeObject(courseNames); var model = new StringContent(jsonInString, Encoding.UTF8, "application/json"); - var response = await _httpClient.PostAsync("api/Courses", model); + var response = await _httpClient.PostAsync("api/Courses/loadData", model); if (response.StatusCode != HttpStatusCode.OK) { result.HasError = true;