Esempio n. 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Series).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SeriesExists(Series.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Movie).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MovieExists(Movie.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            //var client = new HttpClient();
            //HttpResponseMessage response = await client.PutAsJsonAsync(
            //"https://localhost:44349/api/Movies/Edit", Movie);
            //response.EnsureSuccessStatusCode();

            //// Deserialize the updated product from the response body.
            //Movie = await response.Content.ReadAsAsync<Movie>();

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