public void EditTicket(AdminTicketVM editedTicket, int id) { Ticket model; using (ApplicationDbContext db = new ApplicationDbContext()) { model = db.Tickets.FirstOrDefault(x => x.TicketID == id); model.SolutionID = editedTicket.SolutionID; model.Description = editedTicket.Description; model.UserID = editedTicket.UserID; model.User = editedTicket.User; model.DateOpened = editedTicket.DateOpened; model.DateClosed = editedTicket.DateClosed; model.DateDeleted = editedTicket.DateDeleted; model.Status = editedTicket.Status; model.Urgency = editedTicket.Urgency; model.TicketType = editedTicket.TicketType; db.SaveChanges(); }; }
public IHttpActionResult Post(AdminTicketVM newTicket, int id) { _adapter.newTicket(newTicket, id); return Ok(); }
public void newTicket(AdminTicketVM newTicket, int id) { Ticket model = new Ticket(); Solution solutionModel; using (ApplicationDbContext db = new ApplicationDbContext()) { solutionModel = db.Solutions.FirstOrDefault(x => x.SolutionID == id); model.SolutionID = id; model.Description = newTicket.Description; model.DateOpened = newTicket.DateOpened; model.DateClosed = newTicket.DateClosed; model.Status = newTicket.Status; model.Urgency = newTicket.Urgency; model.TicketType = newTicket.TicketType; solutionModel.Tickets.Add(model); db.SaveChanges(); } }
public IHttpActionResult Post(AdminTicketVM editedTicket, int id) { _adapter.EditTicket(editedTicket, id); return Ok(); }