public ActionResult <TicketDto> Get(int id) { var ticket = _ticketSrvice.GetById(id); if (ticket == null) { return(NotFound()); } return(_ticketSrvice.GetById(id)); }
public IActionResult Get(int id) { try { var ticket = service.GetById(id); return(Ok(ticket)); } catch (ValidationException e) { return(BadRequest(new { Exception = e.Message })); } }
public IActionResult Details(int id) { var ticket = _ticketsService.GetById(id); var ticketDetailsModel = ticket.ToDetailsModel(); return(View(ticketDetailsModel)); }
public StatusModel Add(string comment, int ticketId, int userId) { var response = new StatusModel(); var ticket = _ticketsService.GetById(ticketId); if (ticket != null) { var newComment = new Comment() { Message = comment, DateCreated = DateTime.Now, TicketId = ticketId, UserId = userId }; _commentsRepository.Add(newComment); } else { response.IsSuccessful = false; response.Message = $"The Ticket with Id {ticketId} was not found"; } return(response); }
public async Task <IActionResult> Get(int id) { TicketDTO ticket = await service.GetById(id); if (ticket == null) { return(NotFound()); } return(Ok(ticket)); }