private bool ValidateSwimTime(SwimTime validating) { if (validating.MinHoursPerVisit < 0) { Validator.AddError("Creating.MinHoursPerVisit", "Min Hours must be greater than 0"); } if (validating.MaxHoursPerVisit < 0) { Validator.AddError("Creating.MaxHoursPerVisit", "Max Hours must be greater than 0"); } if (validating.MinHoursPerVisit > validating.MaxHoursPerVisit) { Validator.AddError("Creating.MaxHoursPerVisit", "Max Hours must be larger than Min Hours"); } if (validating.Start < new DateTime(2010, 01, 01)) { Validator.AddError("Creating.Start", "Start Date must be after 01/01/2010"); } if (validating.Start > validating.End) { Validator.AddError("Creating.End", "The End Date must be after the Start Date"); } return(Validator.IsValid); }
public bool EditSwimTime(SwimTime editing) { if (ValidateSwimTime(editing)) { return(Repository.EditSwimTime(editing)); } else { return(false); } }
public bool EditSwimTimeRule(SwimTime swimTimeRulesToEdit) { if (ValidateTerm(swimTimeRulesToEdit)) { return(Repository.EditSwimTimeRule(swimTimeRulesToEdit));//create term } else { return(false);//pass up invalid flag } }
public bool CreateSwimTime(SwimTime create) { //VALIDATEION HERE USE VALIDATION SPACE BELOW!! model it off those methods and return false if it doesn't work if (ValidateSwimTime(create)) { return(Repository.CreateSwimTime(create)); } else { return(false); } }
//for creation view public CreateEditSwimTimeRulesViewModel(List <Course> courseList, SwimTime input) { Creating = input; DaysList = Days.Select(x => new SelectListItem { Text = x.Obj, Value = x.Val.ToString() }); IEnumerable <Course> CTOnly = from co in courseList where co.CheckOut select co; Course = CTOnly.Select(x => new SelectListItem { Text = x.Title + " " + x.CRN, Value = x.CRN.ToString() }); RepetitionSchedule = Repetition.Select(x => new SelectListItem { Text = x.Obj, Value = x.Val.ToString() }); }
//validation protected bool ValidateTerm(SwimTime swimTimeRuleToValidate) { return(true); }
public bool EditSwimTime(SwimTime editing) { return(Service.EditSwimTimeRule(editing)); }
public bool CreateSwimTime(SwimTime create) { return(Service.CreateSwimTimeRule(create)); }
public ActionResult editSwimTime(int id) { SwimTime editing = Service.GetSwimTimeByID(id); return(View(new CreateEditSwimTimeRulesViewModel(editing, Service.ListAllCourses()))); }
public bool EditSwimTimeRule(SwimTime swimTimeRulesToEdit) { return(Service.EditSwimTimeRule(swimTimeRulesToEdit)); }
public bool CreateSwimTimeRule(SwimTime swimTimeRulesToCreate) { return(Service.CreateSwimTimeRule(swimTimeRulesToCreate)); }