public ActionResult FixtureAdd(FixtureAddViewModel fixtureAddViewModel) { if (ModelState.IsValid) { fixtureAddViewModel.Fixture.Home = clubRepository.GetById(fixtureAddViewModel.HomeClubId); fixtureAddViewModel.Fixture.Away = clubRepository.GetById(fixtureAddViewModel.AwayClubId); fixtureRepository.Insert(fixtureAddViewModel.Fixture); return(RedirectToAction("FixtureList", "Home")); } else { // Not sure how can I pass this to the get method. ViewBag.Error = "Invalid values. Match not saved."; return(RedirectToAction("FixtureAdd", "Home")); } }
public void Put(int id, [FromBody] TFixture value) { FixtureRepository.Insert <TFixture, TAvailableSources>(value); }