// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { // Checks the ensure the model state is valid, if not returns the page and doesn't process anything. if (!ModelState.IsValid) { return(Page()); } // Gets the modified state of the software. _context.Attach(Software).State = EntityState.Modified; WebRequest webRequest = WebRequest.Create(Software.DownloadURL); WebResponse webResponse; try { webResponse = webRequest.GetResponse(); } catch (System.Exception) { return(RedirectToPage("/Error")); } // Saves the changes if the software still exists. try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SoftwareExists(Software.Id)) { return(NotFound()); } else { throw; } } // Redirects the user to software index page. return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(ClippedSoftware).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClippedSoftwareExists(ClippedSoftware.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }