Ejemplo n.º 1
0
        public async Task <School> AddSchool(string schoolName, int districtId)
        {
            VerifyPermission(Permission.ManageSchools);

            return(await _schoolRepository.AddSaveAsync(GetClaimId(ClaimType.UserId),
                                                        new School
            {
                SiteId = GetCurrentSiteId(),
                Name = schoolName,
                SchoolDistrictId = districtId
            }));
        }
Ejemplo n.º 2
0
        public async Task <School> AddEnteredSchoolToList(int enteredSchoolId,
                                                          string schoolName,
                                                          int schoolDistrictId,
                                                          int schoolTypeId)
        {
            VerifyPermission(Permission.ManageSchools);
            var enteredSchool = await _enteredSchoolRepository.GetByIdAsync(enteredSchoolId);

            var newSchool = await _schoolRepository.AddSaveAsync(GetClaimId(ClaimType.UserId),
                                                                 new School
            {
                Name             = schoolName,
                SchoolDistrictId = schoolDistrictId,
                SiteId           = enteredSchool.SiteId,
                SchoolTypeId     = schoolTypeId
            });

            await _enteredSchoolRepository.ConvertSchoolAsync(GetClaimId(ClaimType.UserId),
                                                              enteredSchoolId,
                                                              newSchool.Id);

            return(newSchool);
        }
Ejemplo n.º 3
0
        public async Task <School> AddSchool(string schoolName, int districtId, int?typeId)
        {
            VerifyPermission(Permission.ManageSchools);
            var district = await _schoolDistrictRepository.GetByIdAsync(districtId);

            if (district.IsCharter || district.IsPrivate)
            {
                typeId = null;
            }
            else if (typeId.HasValue == false)
            {
                throw new GraException("No school type selected.");
            }
            return(await _schoolRepository.AddSaveAsync(GetClaimId(ClaimType.UserId),
                                                        new School
            {
                SiteId = GetCurrentSiteId(),
                Name = schoolName,
                SchoolDistrictId = districtId,
                SchoolTypeId = typeId
            }));
        }