public static User CreateDemoUser(Guid districtRef, Guid userId, string login) { var schoolUsers = new List <SchoolUser>(); var school = DemoSchoolService.CreateMasterSchool(districtRef); var district = DemoDistrictService.CreateDemoDistrict(districtRef); var user = new User { ConfirmationKey = null, DistrictRef = districtRef, Id = userId, IsDeveloper = false, IsSysAdmin = false, Login = login, IsDemoUser = true, District = district, LoginInfo = new UserLoginInfo { Id = userId } }; schoolUsers.Add(new SchoolUser { School = school, User = user }); user.SchoolUsers = schoolUsers; return(user); }
public void AddDistrict(UserContext userContext) { if (!userContext.DistrictId.HasValue) { throw new Exception("Context doesn't have valid district id"); } var districtId = userContext.DistrictId.Value; var district = DemoDistrictService.CreateDemoDistrict(districtId); DistrictStorage.Add(district); }