public HttpResponseMessage GetLessonsByAudithory(double audithory) { if (audithory > 2.0 || audithory < 0.0009) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert only double; example 6.200")); } var list = ModelMap.LessonDomainToView(manager.getLessonsByAuditory(audithory)); var response = Request.CreateResponse <IEnumerable <LessonViewModel> >(HttpStatusCode.OK, list); return(response); }
public HttpResponseMessage GetLessonsByGroup(string groupName) { if (!Regex.IsMatch(groupName, @"^[\d|\D]{1,40}$")) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Name is too long!")); } if (groupName == null || groupName.Length == 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert group name")); } if (!Regex.IsMatch(groupName, @"^\w{2}-\d{3}")) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert group name")); } var list = ModelMap.LessonDomainToView(teacher.getLessonsByGroup(groupName)); var response = Request.CreateResponse <IEnumerable <LessonViewModel> >(HttpStatusCode.OK, list); return(response); }
public HttpResponseMessage GetLessonsByName(string teacherName) { if (!Regex.IsMatch(teacherName, @"^[\d|\D]{1,40}$")) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Name is too long!")); } if (teacherName == null || teacherName.Length == 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert name")); } if (Regex.IsMatch(teacherName, @"^.*\d+.*$")) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert only letters")); } var list = ModelMap.LessonDomainToView(teacher.getLessonsByTeacher(teacherName)); var response = Request.CreateResponse <IEnumerable <LessonViewModel> >(HttpStatusCode.OK, list); return(response); }
public HttpResponseMessage GetLessonsByDiscipline(string discipline) { if (!Regex.IsMatch(discipline, @"^[\d|\D]{1,40}$")) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Discipline is too long!")); } if (discipline == null || discipline.Length == 0) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert Discipline")); } if (Regex.IsMatch(discipline, @"^.*\d+.*$")) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Pelease insert only letters")); } var list = ModelMap.LessonDomainToView(manager.getLessonsByDiscipline(discipline)); var response = Request.CreateResponse <IEnumerable <LessonViewModel> >(HttpStatusCode.OK, list); return(response); }