예제 #1
0
 public void Update(Data.Entities.Student student, string profilePhotoUrl, int?sessionId, int dayFrom, int dayTo)
 {
     StudentUsi      = student.StudentUSI;
     FirstName       = student.FirstName;
     LastName        = student.LastSurname;
     ProfilePhotoUrl = profilePhotoUrl;
     SessionId       = sessionId;
     DayFrom         = dayFrom;
     DayTo           = dayTo;
 }
예제 #2
0
        public static SetModel CreateNewWith(Data.Entities.Student student, string profilePhotoUrl, List <SessionListItemModel> sessions, SessionListItemModel session, List <Section.SectionListItemModel> currentlyEnrolledSections)
        {
            var setModel = new SetModel
            {
                StudentName               = String.Join(" ", student.FirstName, student.LastSurname),
                StudentUsi                = student.StudentUSI,
                ProfilePhotoUrl           = profilePhotoUrl,
                Sessions                  = sessions,
                Session                   = session.SessionId,
                BeginDate                 = session.BeginDate,
                EndDate                   = session.EndDate,
                CurrentlyEnrolledSections = currentlyEnrolledSections
            };

            return(setModel);
        }
예제 #3
0
            public CSharpFunctionalExtensions.Result Handle(EditAddStudentCommand command)
            {
                var student = _context.Students.Find(command.Id);

                if (student == null)
                {
                    student = new Data.Entities.Student();
                    _context.Students.Add(student);
                    _context.SaveChanges();
                }

                if (!string.IsNullOrWhiteSpace(command.StudentCardNumber))
                {
                    student.StudentCardNumber = command.StudentCardNumber;
                }

                if (command.Gender.HasValue)
                {
                    student.Gender = command.Gender.Value;
                }

                if (!string.IsNullOrWhiteSpace(command.Email))
                {
                    student.Email = command.Email;
                }

                if (!string.IsNullOrWhiteSpace(command.Name))
                {
                    student.Name = command.Name;
                }

                if (command.SchoolClassId.HasValue)
                {
                    student.SchoolClassId = command.SchoolClassId.Value;
                }

                if (command.ShouldResultsBeHidden.HasValue)
                {
                    student.HiddenResults = command.ShouldResultsBeHidden.Value;
                }

                _context.Students.Update(student);
                _context.SaveChanges();
                return(Result.Ok());
            }
예제 #4
0
        public string GetProfilePhotoUrlOrDefault(Data.Entities.Student student)
        {
            var profilePhotoUrl = _downloader.DownloadPath("student", student.StudentUSI + "/profilePhoto");

            return(profilePhotoUrl.IsNullOrEmpty() ? DefaultProfilePhotoUrl : profilePhotoUrl);
        }
예제 #5
0
 public StudentInviteCommand(string token, Data.Entities.Student student)
 {
     Token   = token;
     Student = student;
 }
예제 #6
0
 public UserRegisteredCommand(Data.Entities.Student student)
 {
     Student = student;
 }
예제 #7
0
 public override void Map(Data.Entities.Student source, GradeModel target)
 {
     target.StudentFirstName = source.FirstName;
     target.StudentLastName  = source.LastSurname;
     target.StudentUSI       = source.StudentUSI;
 }