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 })); }
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); }
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 })); }