public ActionResult delete(int id) { PhaseRepository phase_rep = new PhaseRepository(); Phase phase = new Phase(); //GET PHASE try { phase = phase_rep.getPhase(id); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve phase: " + exception.Message; return(RedirectToAction("Index")); } //DELETE PHASE try { phase_rep.delete(phase); TempData["flash"] = "Deleted phase."; return(RedirectToAction("Index")); } catch (Exception exception) { TempData["flash"] = "Unable to delete phase: " + exception.Message; return(RedirectToAction("Index")); } }
public ActionResult edit(FormCollection collection) { //Generate new phase object for form if error PhaseRepository phase_rep = new PhaseRepository(); Phase phase = new Phase(); //GET PHASE try { phase = phase_rep.getPhase(Int32.Parse(collection["phase_id"])); TempData["phase"] = phase; } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve phase: " + exception.Message; return(RedirectToAction("edit", new { controller = "Phases", id = collection["phase_id"] })); } //UPDATE PHASE try { return(phaseFormProcess(phase, phase_rep, collection)); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to update phase: " + exception.Message; return(RedirectToAction("edit", new { controller = "Phases", id = collection["phase_id"] })); } }
public ActionResult index() { PhaseRepository phase_rep = new PhaseRepository(); ViewData["all_phases"] = phase_rep.getAll(); return(View()); }
public void Initialize() { phaseRepository = ApplicationFactory.getPhaseRepository(); phase = new Phase(); phase.Name = "Test"; phase.Deadline = DateTime.Now; }
public void TestSetup() { InitializeDB db = new InitializeDB(); Database.SetInitializer(db); repository = new PhaseRepository(); }
public ActionResult edit(int id) { PhaseRepository phase_rep = new PhaseRepository(); ViewData["phase_id"] = id.ToString(); ViewData["phase"] = phase_rep.getPhase(id); ViewData["edit"] = true; return(View()); }
public ActionResult create() { //Generate new phase object PhaseRepository phase_rep = new PhaseRepository(); Phase phase = new Phase(); ViewData["edit"] = false; ViewData["phase"] = phase; return(View()); }
public Contest() { FlippingContainer.Instance.ComposeParts(this); _gameSetting = new ReferenceHolder <IGameSetting, Guid>(GameSettingRepository); _physicalSetting = new ReferenceHolder <IPhysicalSetting, Guid>(PhysicalSettingRepository); _eliminationSetting = new ReferenceHolder <IEliminationStepSetting, Guid>(EliminationStepSettingRepository); _consolingEliminationSetting = new ReferenceHolder <IEliminationStepSetting, Guid>(EliminationStepSettingRepository); _qualificationSetting = new ReferenceHolder <IQualificationStepSetting, Guid>(QualificationStepSettingRepository); _phaseList = new Lazy <IList <IPhase> >(() => PhaseRepository.Find(_ => _.ContestId == Id).ToList()); _fieldList = new Lazy <IList <IField> >(() => FieldRepository.Find(_ => _.CurrentContestId == Id).ToList()); _teamList = new Lazy <IList <ITeam> >(() => TeamRepository.Find(_ => _.ContestId == Id).ToList()); }
public void Initialize() { conferenceRepository = ApplicationFactory.getConferenceRepository(); phaseRepository = ApplicationFactory.getPhaseRepository(); conference = new Conference(); newConference = new Conference(); phase = new Phase(); conference.ConferenceFee = 150; conference.Name = "Test"; conference.StartDate = DateTime.Now; phase.Name = "Test"; conference.ActivePhase = phase; newConference.Name = "Before"; newConference.ConferenceFee = 100; }
//PROCESS EDIT AND CREATE FORMS private ActionResult phaseFormProcess(Phase phase, PhaseRepository phase_rep, FormCollection collection) { try { phase.PhaseDesc = collection["phase_description"]; phase.PhaseStartDate = DateTime.Parse(collection["start_date"]); phase.Deleted = false; phase_rep.save(phase); TempData["flash"] = "Phase: " + phase.PhaseDesc; return(RedirectToAction("Index")); } catch (Exception exception) { throw new Exception("A data entry problem has occurred."); } }
public ActionResult create(FormCollection collection) { //Generate new phase object PhaseRepository phase_rep = new PhaseRepository(); Phase phase = new Phase(); ViewData["edit"] = false; ViewData["phase"] = phase; try { return(phaseFormProcess(phase, phase_rep, collection)); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to create phase: " + exception.Message; return(RedirectToAction("create")); } }