コード例 #1
0
 public static List <StudentPaymentDto> Convert(StudentPayments studentPayments)
 {
     if (studentPayments != null)
     {
         List <StudentPaymentDto> studentPaymentsDto = new List <StudentPaymentDto>();
         foreach (StudentPayment studentPayment in studentPayments)
         {
             StudentPaymentDto item = ConvertToDto(studentPayment);
             studentPaymentsDto.Add(item);
         }
         return(studentPaymentsDto);
     }
     return(null);
 }
コード例 #2
0
ファイル: StudentController.cs プロジェクト: amutalev1/lev1
 public HttpResponseMessage InsertStudentPayment([FromBody] StudentPaymentDto studentPaymentDto)
 {
     try
     {
         StudentPayment studentPayment = Converters.Convert(studentPaymentDto);
         if (!ValidateModel.IsValid(new List <object>()
         {
             studentPayment
         }))
         {
             return(Request.CreateResponse(HttpStatusCode.BadRequest, ValidateModel.ModelsResults));
         }
         StudentManager.InsertStudentPayment(studentPayment);
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, $"Failed to insert the  payment of student, {ex.Message}"));
     }
 }
コード例 #3
0
 public static StudentPayment Convert(StudentPaymentDto studentPaymentDto)
 {
     if (studentPaymentDto == null)
     {
         return(null);
     }
     return(new StudentPayment()
     {
         AttendanceSum = studentPaymentDto.AttendanceSum,
         DentalHealthSupportSum = studentPaymentDto.DentalHealthSupportSum,
         ExamsSum = studentPaymentDto.ExamsSum,
         FinancialSupportSum = studentPaymentDto.FinancialSupportSum,
         HealthSupportSum = studentPaymentDto.HealthSupportSum,
         LoansGivenSum = studentPaymentDto.LoansGivenSum,
         LoansReturnSum = studentPaymentDto.LoansReturnSum,
         Month = studentPaymentDto.Month,
         PaymentSum = studentPaymentDto.PaymentSum,
         StateBudgetSum = studentPaymentDto.StateBudgetSum,
         Year = studentPaymentDto.Year,
         Student = studentPaymentDto.Student
     });
 }