Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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));
        }