public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } SupportTickets.Updated = DateTime.Now; SupportTickets.Status = Request.Form["StatusData"].ToString(); SupportTickets.Assigned = Request.Form["AssignedData"].ToString(); _context.Attach(SupportTickets).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupportTicketsExists(SupportTickets.id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } SupportTickets = await _context.SupportTickets.FindAsync(id); if (SupportTickets != null) { _context.SupportTickets.Remove(SupportTickets); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, 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()); } SupportTickets.created = DateTime.Now; SupportTickets.Updated = null; SupportTickets.Status = "Pending"; SupportTickets.pathFile = ProcessUploadedFile(); _context.SupportTickets.Add(SupportTickets); await _context.SaveChangesAsync(); return(RedirectToPage("./Response")); }