Beispiel #1
0
 public static List <FinancialSupportRequestDto> Convert(FinancialSupportRequests financialSupportRequests)
 {
     if (financialSupportRequests != null)
     {
         List <FinancialSupportRequestDto> financialSupportRequestsDto = new List <FinancialSupportRequestDto>();
         foreach (FinancialSupportRequest financialSupportRequest in financialSupportRequests)
         {
             FinancialSupportRequestDto item = ConvertToDto(financialSupportRequest);
             financialSupportRequestsDto.Add(item);
         }
         return(financialSupportRequestsDto);
     }
     return(null);
 }
Beispiel #2
0
 public static FinancialSupportRequest Convert(FinancialSupportRequestDto financialSupportRequestDto)
 {
     if (financialSupportRequestDto == null)
     {
         return(null);
     }
     return(new FinancialSupportRequest()
     {
         ApprovedAmount = financialSupportRequestDto.ApprovedAmount,
         branch = financialSupportRequestDto.branch,
         CurrentStatus = financialSupportRequestDto.CurrentStatus,
         Date = financialSupportRequestDto.Date,
         Details = financialSupportRequestDto.Details,
         DigitalSignature = financialSupportRequestDto.DigitalSignature,
         Id = financialSupportRequestDto.Id,
         IsApproved = financialSupportRequestDto.IsApproved,
         Iscanceled = financialSupportRequestDto.Iscanceled,
         NumberOfMonthsApproved = financialSupportRequestDto.NumberOfMonthsApproved,
         Student = financialSupportRequestDto.Student
     });
 }
        public HttpResponseMessage InsertFinancialSupportRequest([FromBody] FinancialSupportRequestDto financialSupportRequestDto, [FromUri] int studentId)
        {
            try
            {
                FinancialSupportRequest financialSupportRequest = Converters.Convert(financialSupportRequestDto);
                if (!ValidateModel.IsValid(new List <object>()
                {
                    financialSupportRequest
                }))
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, ValidateModel.ModelsResults));
                }
                FinancialSupportManager.InsertFinancialSupportRequest(financialSupportRequest);

                return(Request.CreateResponse(HttpStatusCode.OK, financialSupportRequest.Id));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, $"Failed to insert the financial support request, {ex.Message}"));
            }
        }