Exemplo n.º 1
0
        public async Task <IActionResult> ChangeStatus([FromBody] ChangeTicketStatusViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(viewModel));
            }

            viewModel.UserId = _user.Id;

            await _userSchoolingEventTicketService.ChangeTicketStatus(viewModel);

            return(Response(new { }));
        }
Exemplo n.º 2
0
        public ActionResult ChangeStatus(int id)
        {
            var ticket = _ticketRepository.Get(id);

            var vm = new ChangeTicketStatusViewModel
            {
                Status           = ticket.Status,
                AssignedToUserId = ticket.AssignedToUserId,
                DueDate          = ticket.DueDate
            };

            ViewBag.TicketCategoryId    = new SelectList(_ticketCategoryRepository.GetAll(), "Id", "Title", ticket.TicketCategoryId);
            ViewBag.TicketSubCategoryId = new SelectList(_ticketSubCategoryRepository.GetAll(), "Id", "Title", ticket.TicketSubCategoryId);
            ViewBag.AssignedToUserId    = new SelectList(_userRepository.GetAllBy(u => u.Id != 1 && u.EmployeeStatus != EmployeeStatus.Ex, "Person"), "Id", "Person.Name", WebUser.Id);

            return(CheckForNullAndExecute(ticket, () => View(vm)));
        }
Exemplo n.º 3
0
        public ActionResult ChangeStatus(ChangeTicketStatusViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var selectedTicket = _ticketRepository.Get(vm.Id);
                if (selectedTicket != null)
                {
                    selectedTicket.Status           = vm.Status;
                    selectedTicket.AssignedToUserId = vm.AssignedToUserId;
                    selectedTicket.DueDate          = vm.DueDate;

                    selectedTicket.UpdatedByUserId = WebUser.Id;

                    _ticketRepository.Update(selectedTicket);
                    _unitOfWork.Commit();


                    // Add it as an Activity
                    var newActivity = new TicketActivity
                    {
                        Title           = Enum.GetName(vm.Status.GetType(), vm.Status),
                        Comment         = vm.Comments,
                        TicketId        = selectedTicket.Id,
                        CreatedByUserId = WebUser.Id
                    };

                    _ticketActivityRepository.Create(newActivity);
                    _unitOfWork.Commit();

                    #if !DEBUG
                    _emailComposerService.TicketUpdated(selectedTicket.Id);
                    #endif

                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.AssignedToUserId = new SelectList(_userRepository.GetAllBy(u => u.Id != 1 && u.EmployeeStatus != EmployeeStatus.Ex, "Person"), "Id", "Person.Name");

            return(View(vm));
        }
Exemplo n.º 4
0
        public JsonResult changeStatus(ChangeTicketStatusViewModel model)
        {
            Response response;

            try
            {
                using (var db = new KiaGalleryContext())
                {
                    var entity = db.Ticket.Find(model.id);
                    entity.TicketStatus = model.status;
                    db.SaveChanges();
                }
                response = new Response()
                {
                    status  = 200,
                    message = "تیکت با موفقیت حذف شد."
                };
            }
            catch (Exception ex)
            {
                response = Core.GetExceptionResponse(ex);
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
        public async Task ChangeTicketStatus(ChangeTicketStatusViewModel viewModel)
        {
            var command = Mapper.Map <ChangeTicketStatusCommand>(viewModel);

            await _bus.SendCommand(command);
        }