Ejemplo n.º 1
0
        public async Task <IActionResult> PutGenre(Guid id, Genre genre)
        {
            if (id != genre.Id)
            {
                return(BadRequest());
            }

            try
            {
                await _genreService.UpdateGenreAsync(id, genre);
            }
            catch (ArgumentNullException ex)
            {
                return(NotFound(ex.Message));
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPost(Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            try
            {
                Genre.Id = id;
                await _genreService.UpdateGenreAsync(id, Genre);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(RedirectToPage("./Genres"));
        }