Example #1
0
 public static StudentDto MapFromPrototype(this StudentPrototype student, IStudentMappingHelper helper)
 {
     var dto = new StudentDto()
     {
         AmountFromEnvelope = student.AmountFromEnvelope.CastToDecimal(),
         AmountFromWebsite = student.AmountFromWebsite.CastToDecimal(),
         FundraisingGoal = student.FundraisingGoal.CastToDecimal(),
         Comments = student.Comments,
         EnvelopeNumber = student.EnvelopeNumber,
         FirstName = student.FirstName,
         LastName = student.LastName,
         Grade = student.Grade,
         MinutesRead = student.MinutesRead.CastToInt(),
         PagesRead = student.PagesRead.CastToInt(),
         ReadingGoal = student.ReadingGoal.CastToInt(),
         SchoolName = helper.School.Name,
         ShirtSize = student.ShirtSize,
         Address1 = student.Address1,
         Address2 = student.Address2,
         City = student.City,
         State = student.State,
         Zip = student.Zip,
         Phone = student.Phone
     };
     if (helper.Teacher != null)
     {
         dto.TeacherId = helper.Teacher.Id;
     }
     return dto;
 }
 public StudentController(IStudentProcessingService svc, 
     IStudentRepository studentRepo, IStudentMappingHelper helper, ISchoolRepository schoolRepo)
 {
     _svc = svc;
     _studentRepo = studentRepo;
     _helper = helper;
     _schoolRepo = schoolRepo;
 }
Example #3
0
 public static StudentDto MergeWithModel(this Student student, StudentDto dto, 
     IStudentMappingHelper helper)
 {
     dto.Id = student.Id;
     dto.AmountFromEnvelope = student.AmountFromEnvelope.CastToDecimal();
     dto.AmountFromWebsite = student.AmountFromWebsite.CastToDecimal();
     dto.FundraisingGoal = student.FundraisingGoal.CastToDecimal();
     dto.EnvelopeNumber = student.EnvelopeNumber;
     dto.FirstName = student.FirstName;
     dto.LastName = student.LastName;
     dto.Grade = student.Grade;
     dto.MinutesRead = student.MinutesRead.CastToInt();
     dto.PagesRead = student.PagesRead.CastToInt();
     dto.ReadingGoal = student.ReadingGoal.CastToInt();
     dto.SchoolName = helper.School.Name;
     dto.ShirtSize = student.ShirtSize;
     dto.Address1 = student.Address1;
     dto.Address2 = student.Address2;
     dto.City = student.City;
     dto.State = student.State;
     dto.Zip = student.Zip;
     dto.Phone = student.Phone;
     dto.TeacherId = helper.Teacher.Id;
     dto.Comments = student.Comments;
     return dto;
 }