public async Task AddSetAsync_WhenCalled_SaveSetInDbAsync() { var initialCount = _setUpContext.Sets.Count(); var set = new Set { Id = 5 }; await _setService.AddSetAsync(set); var currentCount = _context.Sets.Count(); Assert.That(currentCount, Is.GreaterThan(initialCount)); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } await _setService.AddSetAsync(this.Set); return(RedirectToPage("./Index")); }
public async Task <IActionResult> Post([FromBody] SetDTO setDTO) { var result = await _setService.AddSetAsync(setDTO); return(Ok(result)); }