Beispiel #1
0
 public void ModifyGroup()
 {
     GroupManagementService.UpdateGroup(new Group()
     {
         Id             = Id,
         Name           = Name,
         GraduationYear = GraduationYear,
         StartYear      = StartYear
     });
 }
Beispiel #2
0
        public void ModifyLecturer()
        {
            var selectedGroups = SelectedGroupIds != null && SelectedGroupIds.Count > 0
                ? GroupManagementService.GetGroups(new Query <Group>(x => SelectedGroupIds.Contains(x.Id)))
                : new List <Group>();

            foreach (var group in GroupManagementService.GetGroups(new Query <Group>(x => x.SecretaryId == LecturerId)))
            {
                group.SecretaryId = null;
                GroupManagementService.UpdateGroup(group);
            }

            if (IsSecretary)
            {
                foreach (var group in selectedGroups)
                {
                    group.SecretaryId = LecturerId;
                    GroupManagementService.UpdateGroup(group);
                }
            }

            LecturerManagementService.UpdateLecturer(new Lecturer
            {
                Id          = LecturerId,
                FirstName   = Name,
                LastName    = Surname,
                Skill       = Skill,
                MiddleName  = Patronymic,
                IsSecretary = IsSecretary,
                IsLecturerHasGraduateStudents = IsLecturerHasGraduateStudents,
                SecretaryGroups = selectedGroups,
                IsActive        = IsActive,
                User            = new User
                {
                    Id           = LecturerId,
                    Avatar       = Avatar,
                    UserName     = UserName,
                    About        = About,
                    SkypeContact = SkypeContact,
                    Phone        = Phone,
                    Email        = Email
                }
            });
        }