public IActionResult Get(int id) { if (id.Equals(0) || _sportAccess.GetSport(id) == null) { return(BadRequest()); } var resource = new SportResource(_sportAccess.GetSport(id)); var response = new HALResponse(resource).AddSelfLink(Request).AddLinks( new Link("sport", "/api/Sport/", null, "GET")); return(Ok(response)); }
public IActionResult AddSportAttributeConfirmed(SportAttributesViewModel viewModel) { ViewBag.Title = "Sportmateriaal toevoegen"; if (ModelState.ContainsKey("NewAttribute.Sport") && ModelState.ContainsKey("NewAttribute.Hall")) { ModelState["NewAttribute.Sport"].ValidationState = ModelValidationState.Valid; ModelState["NewAttribute.Hall"].ValidationState = ModelValidationState.Valid; } if (!ModelState.IsValid) { viewModel.Sports = _sportAccess.GetSports(); return(View(viewModel)); } viewModel.NewAttribute.Hall = _complexAccess.GetHall(viewModel.SportHallId); viewModel.NewAttribute.Sport = _sportAccess.GetSport(viewModel.SportId); _complexAccess.AddSportAttribute(viewModel.NewAttribute); return(RedirectToAction("SportAttribute", viewModel)); }
public ViewResult UpdateSport(int id) { ViewBag.Title = "Sport wijzigen"; return(View(_sportAccess.GetSport(id))); }