public TicketNote(Ticket ticket, User createdBy, string content) { CreatedById = createdBy.UserId; CreatedBy = createdBy; Ticket = ticket; TicketId = ticket.TicketId; Content = content; Created = DateTime.Now; }
public async Task<HttpResponseMessage> Post(TicketModel inputModel) { var me = await _db.Users.FirstAsync(); var ticket = new Ticket(inputModel.Title, TicketPriority.Medium, me); _db.Tickets.Add(ticket); await _db.SaveChangesAsync(); var response = new HttpResponseMessage(HttpStatusCode.Created); response.Headers.Location = new Uri("/api/tickets/" + ticket.TicketId, UriKind.Relative); return response; }