From a58a3b07cfd333b80a6e188429f16695c12e7514 Mon Sep 17 00:00:00 2001 From: esantangelo <enzo020895@gmail.com> Date: Thu, 10 Dec 2020 21:33:11 -0300 Subject: [PATCH] helpers and dtos --- .../Dtos/StudentCourseResultCreateDto.cs | 13 +++++++++++++ .../Dtos/StudentCourseResultPreviewDto.cs | 18 ++++++++++++++++++ .../Helpers/CourseApproval.cs | 11 +++++++++++ .../Helpers/ErrorMessages.cs | 3 +++ .../Helpers/MappingProfile.cs | 6 +++++- 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultCreateDto.cs create mode 100644 Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultPreviewDto.cs create mode 100644 Tsi1.Api/Tsi1.BusinessLayer/Helpers/CourseApproval.cs diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultCreateDto.cs b/Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultCreateDto.cs new file mode 100644 index 0000000..64cb01d --- /dev/null +++ b/Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultCreateDto.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tsi1.BusinessLayer.Dtos +{ + public class StudentCourseResultCreateDto + { + public int Result { get; set; } + public int StudentId { get; set; } + public int CourseId { get; set; } + } +} diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultPreviewDto.cs b/Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultPreviewDto.cs new file mode 100644 index 0000000..b1ca70a --- /dev/null +++ b/Tsi1.Api/Tsi1.BusinessLayer/Dtos/StudentCourseResultPreviewDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tsi1.BusinessLayer.Dtos +{ + public class StudentCourseResultPreviewDto + { + public int Id { get; set; } + + public int Result { get; set; } + + public DateTime Date { get; set; } + + public int StudentId { get; set; } + public int CourseId { get; set; } + } +} diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Helpers/CourseApproval.cs b/Tsi1.Api/Tsi1.BusinessLayer/Helpers/CourseApproval.cs new file mode 100644 index 0000000..bc2af85 --- /dev/null +++ b/Tsi1.Api/Tsi1.BusinessLayer/Helpers/CourseApproval.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tsi1.BusinessLayer.Helpers +{ + public static class CourseApproval + { + public const int MinimumApproval = 3; + } +} diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Helpers/ErrorMessages.cs b/Tsi1.Api/Tsi1.BusinessLayer/Helpers/ErrorMessages.cs index 6812a72..8119e4c 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/Helpers/ErrorMessages.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/Helpers/ErrorMessages.cs @@ -83,5 +83,8 @@ namespace Tsi1.BusinessLayer.Helpers public const string VideoConferenceIsNotEvaluation = "Una video conferencia no es una evaluación"; + public const string CourseAlreadyApproved = "El estudiante '{0}' ya aprovó el curso '{1}'"; + + public const string StudentCourseResultDoesNotExist = "El resultado con id '{0}' no existe"; } } diff --git a/Tsi1.Api/Tsi1.BusinessLayer/Helpers/MappingProfile.cs b/Tsi1.Api/Tsi1.BusinessLayer/Helpers/MappingProfile.cs index 9e8a5bc..0e9175c 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/Helpers/MappingProfile.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/Helpers/MappingProfile.cs @@ -67,7 +67,9 @@ namespace Tsi1.BusinessLayer.Helpers CreateMap<Evaluation, EvaluationModifyDto>(); CreateMap<Evaluation, EvaluationDetailDto>(); CreateMap<EvaluationInscription, EvaluationInscriptionDto>(); - + CreateMap<StudentCourseResult, StudentCourseResultCreateDto>(); + CreateMap<StudentCourseResult, StudentCourseResultPreviewDto>(); + CreateMap<ForumCreateDto, Forum>(); CreateMap<ForumPreviewDto, Forum>(); CreateMap<ForumModifyDto, Forum>(); @@ -120,6 +122,8 @@ namespace Tsi1.BusinessLayer.Helpers CreateMap<EvaluationModifyDto, Evaluation>().ForMember(x => x.Id, opt => opt.Ignore()); CreateMap<EvaluationDetailDto, Evaluation>(); CreateMap<EvaluationInscriptionDto, EvaluationInscription>(); + CreateMap<StudentCourseResultCreateDto, StudentCourseResult>(); + CreateMap<StudentCourseResultPreviewDto, StudentCourseResult>(); } } } -- GitLab