public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } try { await _tinyUrlService.Update(UrlMap); } catch (DbUpdateConcurrencyException) { if (!await UrlMapExists(UrlMap.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <UrlMapOutput> Put(string id, [FromBody] UrlMapInput input) { if (id != input.Id) { throw new Exception("Item does not exist!"); } return(await _tinyUrlService.Update(input)); }