public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var urlMapOutput = await _tinyUrlService.Create(UrlMap); return(RedirectToPage("./Index", new { filter = urlMapOutput.RawUrl })); }
public async Task GetAll_ShouldReturn_CreatedItem() { //Arrange var urlMapInput = new UrlMapInput() { Id = Guid.NewGuid().ToString(), Title = "Test", Description = "Test", RawUrl = "http://test.co.com.bd" }; var urlMapPageOutputBefore = await _tinyUrlService.GetAll(new UrlMapFilterInput()); //Act var urlMapOutput = await _tinyUrlService.Create(urlMapInput); var urlMapPageOutputAfter = await _tinyUrlService.GetAll(new UrlMapFilterInput()); //Assert Assert.NotNull(urlMapOutput); Assert.NotNull(urlMapOutput.ShortenUrl); Assert.Equal(urlMapPageOutputBefore.TotalCount + 1, urlMapPageOutputAfter.TotalCount); Assert.NotEqual(0, urlMapOutput.Identity); }
public async Task <UrlMapOutput> OnPostAsync(UrlMapInput input) { return(await _tinyUrlService.Create(input)); }
public async Task <UrlMapOutput> Post([FromBody] UrlMapInput input) { return(await _tinyUrlService.Create(input)); }