public ActionResult TicketsAssignment(int?id, TicketsAssignmentViewModel formData)
        {
            var ticket = bugTrackerHelper.GetCurrentTicketById(id.Value);

            if (id == null || ticket == null)
            {
                return(RedirectToAction("AllTickets", "Ticket"));
            }

            if (ticket.AssignedToUserId != formData.DeveloperId)
            {
                var newDeveloper = DbContext.Users.FirstOrDefault(p => p.Id == formData.DeveloperId);
                var oldValue     = (ticket.AssignedToUserId == null) ? "not assigned" : ticket.AssignedToUser.DisplayName;

                historyHelper.CreateHistory(oldValue, newDeveloper.DisplayName, ticket.Id, "Assigned Developer");

                ticket.AssignedToUserId = formData.DeveloperId;
                var message = notificationHelper.CreateAssignmentNotification(ticket.Title, newDeveloper.DisplayName);
                notificationHelper.SendNotification(ticket, message, true);
            }

            DbContext.SaveChanges();

            return(RedirectToAction("AllTickets", "Ticket"));
        }
        public ActionResult TicketsAssignment(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction(nameof(TicketController.AllTickets)));
            }

            var model         = new TicketsAssignmentViewModel();
            var currentTicket = bugTrackerHelper.GetCurrentTicketById(id.Value);

            model.Developers  = bugTrackerHelper.GetAllDevelopers();
            model.DeveloperId = currentTicket.AssignedToUserId;

            return(View(model));
        }