public async Task <IActionResult> Move(int cid, CourseActions direction) { var curUser = await _userManager.GetUserAsync(this.User); int sid = curUser.StudentId; if (direction == CourseActions.WishlistPriorityUp) { await _wishlistService.updatePriority(sid, cid, MoveDirection.MoveUp); } else if (direction == CourseActions.WishlistPriorityDown) { await _wishlistService.updatePriority(sid, cid, MoveDirection.MoveDown); } return(RedirectToAction("Wishlist", "Home")); }
public void addCourse(string name, string teacher, string room, string selectedday, string from, string to) { try { string[] dateFrom = from.Split(':'); DateTime dateBegin = new DateTime(); dateBegin = dateBegin.AddHours(double.Parse(dateFrom[0])); dateBegin = dateBegin.AddMinutes(double.Parse(dateFrom[1])); dateBegin = dateBegin.AddYears(2018); string[] dateTo = to.Split(':'); DateTime dateEnd = new DateTime(); dateEnd = dateEnd.AddHours(double.Parse(dateTo[0])); dateEnd = dateEnd.AddMinutes(double.Parse(dateTo[1])); dateEnd = dateEnd.AddYears(2018); if (CourseActions.CourseAdd(name, teacher, room, int.Parse(selectedday), dateBegin, dateEnd, GetSubjectId)) { MessageBox.Show("Course has been added successfully!"); SendMessage("Course added"); } else { MessageBox.Show("An unknown error as occoured!"); } } catch (CourseAlreadyExistsException ex) { ExceptionLogger.LogException(ex); MessageBox.Show("A course with this name on this subject already exists!"); } catch (TeacherBusyException ex) { ExceptionLogger.LogException(ex); MessageBox.Show("This teacher has another course at this time!"); } catch (InvalidTimeException ex) { ExceptionLogger.LogException(ex); MessageBox.Show("The start time of the Course cannot be greater than the end time of the Course."); } catch (Exception e) { ExceptionLogger.LogException(e); MessageBox.Show(e.Message); } }
public void delCourse(int id) { try { CourseActions.DeleteCourse(id); MessageBox.Show("The course has been successfully removed!"); NotifyPropertyChanged("Subjects"); GetCoursesFromLoggedInUsers(); NotifyPropertyChanged("MondayCourses"); NotifyPropertyChanged("TuesdayCourses"); NotifyPropertyChanged("WednesdayCourses"); NotifyPropertyChanged("ThursdayCourses"); NotifyPropertyChanged("FridayCourses"); NotifyPropertyChanged("SaturdayCourses"); NotifyPropertyChanged("SundayCourses"); } catch (Exception e) { ExceptionLogger.LogException(e); MessageBox.Show(e.Message); } }
public IndexModel(ILogger <IndexModel> logger, IMemoryCache cache) { this.cache = cache; _logger = logger; action = new CourseActions((List <Course>)cache.Get("dtset")); }
public CreateModel(IMemoryCache cache) { this.cache = cache; action = new CourseActions((List <Course>)cache.Get("dtset")); count = (int)cache.Get("count"); }
public EditModel(IMemoryCache cache) { this.cache = cache; action = new CourseActions((List <Course>)cache.Get("dtset")); }