public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(PortfolioUpload).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PortfolioUploadExists(PortfolioUpload.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.PortfolioUpload.Add(PortfolioUpload); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } PortfolioUpload = await _context.PortfolioUpload.FindAsync(id); if (PortfolioUpload != null) { //move to trash can moveFileToTrashCanFolder(PortfolioUpload.FileName, DateTime.Now.ToString("[ddMMMyyyy_hhmmss]")); _context.PortfolioUpload.Remove(PortfolioUpload); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }