Ejemplo n.º 1
0
 public ActionResult EditStudent(Student student)
 {
     try
     {
         return _svc.ValidateAndUpdate(student,_helper) ? View("NextStudent", new Schools()) : View("EditStudent", student);
     }
     catch (Exception ex)
     {
         student.ValidationErrorMsgs = "An error occurred: " + ex;
         return View("EditStudent", student);
     }
 }
 public void LoadPrototype(Student prototype)
 {
     School = _schoolRepo.Find(s => s.Name == prototype.SchoolName);
     Teacher = getContactDto(prototype);
 }
 private ContactDto getContactDto(Student request)
 {
     var teacher = School.Contacts.Find(c => c.Id == request.TeacherId);
     return teacher;
 }
Ejemplo n.º 4
0
        public static Student MapToModel(this StudentDto student, ContactDto teacher)
        {
            var stu = new Student()
                       {
                           Id = student.Id,
                           AmountFromEnvelope = student.AmountFromEnvelope,
                           AmountFromWebsite = student.AmountFromWebsite,
                           Comments = student.Comments,
                           EnvelopeNumber = student.EnvelopeNumber,
                           FirstName = student.FirstName,
                           LastName = student.LastName,
                           Grade = student.Grade,
                           MinutesRead = student.MinutesRead,
                           PagesRead = student.PagesRead,
                           SchoolName = student.SchoolName,
                           ShirtSize = student.ShirtSize,
                           Address1 = student.Address1,
                           Address2 = student.Address2,
                           City = student.City,
                           State = student.State,
                           Zip = student.Zip,
                           Phone = student.Phone,
                           TeacherId = student.TeacherId,
                           ReadingGoal = student.ReadingGoal,
                           FundraisingGoal = student.FundraisingGoal,

                       };
            if (teacher != null)
                stu.TeacherName = teacher.LastName;
            return stu;
        }