public ViewResult SportAttribute(SportAttributesViewModel viewModel) { ViewBag.Title = "Sportmaterialen"; viewModel.Attributes = _complexAccess.GetSportAttributes(viewModel.SportHallId); return(View(viewModel)); }
public IActionResult GetAttributes(int id, int hallid) { if (id.Equals(0) && hallid.Equals(0) || _complexAccess.GetSportComplex(id) == null || _complexAccess.GetHall(hallid) == null) { return(BadRequest()); } var attributes = _complexAccess.GetSportAttributes(hallid); var resources = new List <HALResponse>(); foreach (var attribute in attributes) { var resource = new SportAttributeResource(attribute); resources.Add(new HALResponse(resource).AddLinks( new Link("sportattribute", "/api/sportcomplex/" + id + "/hall/" + hallid + "/attribute/" + resource.SportAttributeId + "", null, "GET"), new Link("sport", "/api/sport/" + resource.sportId + "", null, "GET"))); } var response = new HALResponse(new HallResource(_complexAccess.GetHall(hallid))).AddSelfLink(Request).AddEmbeddedCollection("sportattributes", resources); return(Ok(response)); }