public IHttpActionResult UpdateTicket([FromBody] TicketCenterAPI.Models.Ticket ticket) { using (var context = new TicketCenterAPI.Models.ticketcenterdbEntities1()) { context.Configuration.ProxyCreationEnabled = false; //is the model with binding is incorrect if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { //todo change name of SP admin used too // context.usp_ticket(ticket.TicketId,ticket.TechId,ticket.StatusId, ticket.Comment); context.usp_ticket(ticket.TicketId, ticket.TechId, ticket.StatusId, ticket.Comment); } catch { return(NotFound()); } return(Ok("Update succesfull")); } }
public IHttpActionResult AddTicket([FromBody] TicketCenterAPI.Models.Ticket ticket) { using (var context = new TicketCenterAPI.Models.ticketcenterdbEntities1()) { if (!ModelState.IsValid) { return(NotFound()); } context.Configuration.ProxyCreationEnabled = false; try { //by default ticket are open context.ins_tickets(ticket.Description, "", ticket.CategoryId, 1, ticket.ClientId); } catch { return(InternalServerError()); } return(Ok("Ticket succesfull created")); } }