public async void TestAddCompetitionInstance() { //Arrange await _service.AddInstanceAsync(new CompetitionsInstanceViewModel { CompetitionId = 1, Name = "Keppnin 2017" }); //Act var result = (from x in _context.CompetitionInstances select x).Count(); //Assert Assert.Equal(expected: 1, actual: result); }
public async Task <IActionResult> Create(CompetitionsInstanceViewModel model) { if (ModelState.IsValid) { try { await _competitionService.AddInstanceAsync(model); } catch (Exception e) { return(Json(e.Message)); } return(RedirectToAction("Competition", "Admin", new { @competitionId = model.CompetitionId })); } return(View(model)); }