public IHttpActionResult PostTicket(Ticket ticket) { if (ticket == null) { return(BadRequest("ticket object is not present the request body")); } try { ticket.CreatedDate = DateTime.Now; ticket.IsActive = true; ticket.CreatedBy = User.UserId; ticket.DueDate = DateTime.Now.AddDays(8); ticket.StartDate = DateTime.Now; ticket.OwnerId = User.UserId; ticket.TicketNumber = "ticket-225"; ticketsService.CreateTicket(ticket); var receiver = authService.GetUsersAccount(ticket.AssignedTo); var receivers = new List <UserAccountModel>() { receiver }; Notifications.Notification.System <Ticket>(receivers, Notifications.Config.NotificationObjectType.TicketAction, User.UserId, "/Tickets/Management", ticket); var myTickets = ticketsService.GetMyTickets(User.UserId); var html = Helpers.RenderPartial("~/Views/Shared/Partial/Tickets/MyTickets.cshtml", myTickets); return(Ok(html)); } catch (Exception ex) { return(InternalServerError(ex)); } }
// GET: Tickets public ActionResult Management() { ViewData["TicketManagement"] = "active"; var viewModel = new TicketsViewModel() { MyTickets = ticketsService.GetMyTickets(User.UserId), AssignedToMe = ticketsService.GetAssignedTickets(User.UserId), OpenTickets = ticketsService.GetOpenTickets(), AllTicketsPaged = User.IsAdministrator? ticketsService.GetAllTickets() : ticketsService.GetAssignedTickets(User.UserId) }; return(View(viewModel)); }