public long CreateTicket(SupportTicketModel supportTicketModel) { // Add date ticket raised before write to DB supportTicketModel.DateRaised = DateTime.Now; _context.Add(supportTicketModel); _context.SaveChanges(); return(supportTicketModel.TicketId); }
public async Task <IActionResult> Create([Bind("TicketId,ProductId,AssignedEmployeeId,TicketTitle,TicketDetails,DateRaised,DateClosed,CustomerName,CustomerId,CustomerEmail")] SupportTicketModel supportTicketModel) { if (ModelState.IsValid) { // Add date ticket raised before write to DB supportTicketModel.DateRaised = DateTime.Now; _context.Add(supportTicketModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(supportTicketModel)); }