public IHttpActionResult GetEventsObsolete(string divisionAlias, string id, DateTime?weekMonday = null) { if (!int.TryParse(id, out int idValue)) { return(errorsFactory.CreateBadRequest(this, id, nameof(id))); } var division = divisionsService.Get(divisionAlias); if (division == null) { return(errorsFactory.CreateBadRequest(this, $"Study division with '{divisionAlias}' was not found" )); } var events = groupsService.GetWeekEvents(idValue, from: weekMonday); if (events == null) { return(errorsFactory.CreateNotFound(this, $"Student group id={id} was not found" )); } return(Content(HttpStatusCode.OK, events)); }
public IHttpActionResult GetGroupsObsolete(string alias, string id) { if (!int.TryParse(id, out int idValue)) { return(errorsFactory.CreateBadRequest(this, id, nameof(id))); } var division = divisionsService.Get(alias); if (division == null) { return(errorsFactory.CreateNotFound(this, $"The study division '{alias}' was not found" )); } var groups = programsService.GetGroups(idValue); if (groups == null) { return(errorsFactory.CreateNotFound(this, $"Study Program id={id} was not found" )); } // for backwards compatibility // set division alias (outside of programs service) var groupsWithAliases = groups.Groups.Select(g => new ProgramGroupsContract.Group { Id = g.Id, Name = g.Name, Form = g.Form, Profiles = g.Profiles, DivisionAlias = division.Alias }); return(Content(HttpStatusCode.OK, groupsWithAliases)); }
public IHttpActionResult Get() { var divisions = divisionsService.Get(); return(Content(HttpStatusCode.OK, divisions)); }