public ActionResult GetSchedules() { var schedules = PaulRepository.GetSchedules(); var json = Json(schedules); return(json); }
/// <summary> /// RPC-method for optaining metadata, such as the course catalog, /// from schedules specified by their IDs. /// </summary> /// <param name="scheduleIds">Schedule IDs</param> public object[] GetScheduleMetadata(string[] scheduleIds) { var metadata = PaulRepository.GetSchedules(scheduleIds) .Select(schedule => new { Id = schedule.Id, Title = schedule.Name, Users = string.Join(", ", schedule.Users.Select(user => user.Name)) }); return(metadata.ToArray()); }
private async Task <ActionResult> TestDatabaseStoring() { //var courses = PaulRepository.GetLocalCourses("Stochastik"); //Schedule s = new Schedule(); //var user = new User() { Name = "Test" }; //s.User.Add(user); //await PaulRepository.StoreInDatabaseAsync(s, Microsoft.Data.Entity.GraphBehavior.IncludeDependents); //courses.ForEach((async c => await PaulRepository.AddCourseToSchedule(s, c.Id, new List<int>() { user.Id }))); var s = PaulRepository.GetSchedules().Last(); await PaulRepository.RemoveScheduleAsync(s); //var selectedCourse = s.SelectedCourses.First(); //var user = selectedCourse.Users.First(); //await PaulRepository.RemoveUserFromSelectedCourseAsync(selectedCourse, user); //await PaulRepository.AddUserToSelectedCourseAsync(selectedCourse, user.User); return(Ok()); }