private static void AddSkiRun() { SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL(); SkiRun skiRun = new SkiRun(); skiRun = ConsoleView.AddSkiRun(); using (skiRunRepository) { skiRunRepository.InsertSkiRun(skiRun); } ConsoleView.DisplayContinuePrompt(); }
private static void DisplaySkiRunDetail() { SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL(); List<SkiRun> skiRuns; SkiRun skiRun = new SkiRun(); int skiRunID; using (skiRunRepository) { skiRuns = skiRunRepository.SelectAllSkiRuns(); } skiRunID = ConsoleView.GetSkiRunID(skiRuns); using (skiRunRepository) { skiRun = skiRunRepository.SelectSkiRun(skiRunID); } ConsoleView.DisplaySkiRun(skiRun); ConsoleView.DisplayContinuePrompt(); }
private static void DeleteSkiRun() { SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL(); List<SkiRun> skiRuns = skiRunRepository.SelectAllSkiRuns(); SkiRun skiRun = new SkiRun(); int skiRunID; string message; skiRunID = ConsoleView.GetSkiRunID(skiRuns); using (skiRunRepository) { skiRunRepository.DeleteSkiRun(skiRunID); } ConsoleView.DisplayReset(); // TODO refactor message = String.Format("Ski Run ID: {0} had been deleted.", skiRunID); ConsoleView.DisplayMessage(message); ConsoleView.DisplayContinuePrompt(); }
private static void ListAllSkiRuns() { SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL(); List<SkiRun> skiRuns; using (skiRunRepository) { skiRuns = skiRunRepository.SelectAllSkiRuns(); ConsoleView.DisplayAllSkiRuns(skiRuns); ConsoleView.DisplayContinuePrompt(); } }
private static void UpdateSkiRun() { SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL(); List<SkiRun> skiRuns = skiRunRepository.SelectAllSkiRuns(); SkiRun skiRun = new SkiRun(); int skiRunID; using (skiRunRepository) { skiRuns = skiRunRepository.SelectAllSkiRuns(); } skiRunID = ConsoleView.GetSkiRunID(skiRuns); using (skiRunRepository) { skiRun = skiRunRepository.SelectSkiRun(skiRunID); } skiRun = ConsoleView.UpdateSkiRun(skiRun); using (skiRunRepository) { skiRunRepository.UpdateSkiRun(skiRun); } }
private static void QuerySkiRunsByVertical() { SkiRunRepositorySQL skiRunRepository = new SkiRunRepositorySQL(); List<SkiRun> matchingSkiRuns = new List<SkiRun>(); int minimumVertical; int maximumVertical; ConsoleView.GetVerticalQueryMinMaxValues(out minimumVertical, out maximumVertical); using (skiRunRepository) { matchingSkiRuns = skiRunRepository.QueryByVertical(minimumVertical, maximumVertical); } ConsoleView.DisplayQueryResults(matchingSkiRuns); ConsoleView.DisplayContinuePrompt(); }