Exemple #1
0
        public ActionResult RemoveUserFromTicket(Ticket ticket, string removeDev)
        {
            var ticketInfo = db.Tickets.Find(ticket.Id);

            ticketInfo.AssignedToUserId = null;
            db.SaveChanges();
            notifyHelper.SendTicketNotification(ticketInfo.Id);

            return(RedirectToAction("Details", "Tickets", new { ticketInfo.Id }));
        }
Exemple #2
0
        public ActionResult Edit([Bind(Include = "Id,ProjectId,Title,Summary,CreatedDate,UpdatedDate,OwnerId,PriorityId,StatusId,TypeId")] Ticket ticket)
        {
            var ticketNotificationsHelper = new TicketNotificationsHelper();

            if (ModelState.IsValid)
            {
                var oldTicket = db.Tickets.AsNoTracking().FirstOrDefault(t => t.Id == ticket.Id);

                ticket.UpdatedDate     = DateTime.Now;
                db.Entry(ticket).State = EntityState.Modified;
                db.SaveChanges();

                var newTicket = db.Tickets.AsNoTracking().FirstOrDefault(t => t.Id == ticket.Id);


                notificationsHelper.SendTicketNotification(newTicket.Id);
                auditHelper.RecordHistoricalChanges(oldTicket, ticket);
                return(RedirectToAction("Index"));
            }
            ViewBag.OwnerId    = new SelectList(db.Users, "Id", "FirstName", ticket.OwnerId);
            ViewBag.PriorityId = new SelectList(db.Priorities, "Id", "Name", ticket.PriorityId);
            ViewBag.ProjectId  = new SelectList(db.Projects, "Id", "Name", ticket.ProjectId);
            ViewBag.StatusId   = new SelectList(db.Statuses, "Id", "Name", ticket.StatusId);
            ViewBag.TypeId     = new SelectList(db.Types, "Id", "Name", ticket.TypeId);
            return(View(ticket));
        }