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")); }
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")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Series.Add(Series); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Series = await _context.Series.FindAsync(id); if (Series != null) { _context.Series.Remove(Series); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Movie.Add(Movie); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); //var client = new HttpClient(); //HttpResponseMessage response = await client.PostAsJsonAsync( //"https://localhost:44349/api/Movies/Create", Movie); //response.EnsureSuccessStatusCode(); //// Movie = await response.Content.ReadAsAsync<Movie>(); //return RedirectToPage("./Index"); }