Exemple #1
0
        public async Task <IActionResult> PutPlatform(Guid id, Platform platform)
        {
            if (id != platform.Id)
            {
                return(BadRequest());
            }

            try
            {
                await _platformService.UpdatePlatformAsync(id, platform);
            }
            catch (ArgumentNullException ex)
            {
                return(NotFound(ex.Message));
            }

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

            try
            {
                Platform.Id = id;
                await _platformService.UpdatePlatformAsync(id, Platform);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

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