public SupportTicketModel CreateSupportTicketOnTrello(SupportTicketModel supportTicketModel)
        {
            var model = this.CreateSupportTicket(supportTicketModel);
            this.AddNewCardToSupport(model);

            return model;
        }
Example #2
0
        public async Task <IActionResult> Edit(long id, [Bind("TicketId,ProductId,AssignedEmployeeId,TicketTitle,TicketDetails,DateRaised,DateClosed,CustomerName,CustomerId,CustomerEmail")] SupportTicketModel supportTicketModel)
        {
            if (id != supportTicketModel.TicketId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supportTicketModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupportTicketModelExists(supportTicketModel.TicketId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(supportTicketModel));
        }
        public SupportTicketModel CreateSupportTicket(SupportTicketModel supportTicketModel)
        {
            var supportTicket = supportTicketMapper.MapToDomain(supportTicketModel);
            supportTicket.CreatedDate = DateTime.UtcNow;
            supportTicket.Status = (int) Status.Open;
            supportTicketRepository.Save(supportTicket);

            return supportTicketMapper.MapToModel(supportTicket);
        }
 public void AddNewCardToSupport(SupportTicketModel supportTicketModel)
 {
     const string fineAppBoardId = "55b244f75471c89c417c616f";
     var board = new Board(fineAppBoardId);
     var supportList = board.Lists.First(x => x.Name.Equals("Support"));
     var card = supportList.Cards.Add(supportTicketModel.Subject);
     card.Description = string.Format("{0}\n\nStatus: {1}\n\nType: {2}", supportTicketModel.Message,
         ((Status)supportTicketModel.Status).ToDescription(),
         ((SupportType)supportTicketModel.Type).ToDescription());
 }
Example #5
0
        public long CreateTicket(SupportTicketModel supportTicketModel)
        {
            // Add date ticket raised before write to DB
            supportTicketModel.DateRaised = DateTime.Now;

            _context.Add(supportTicketModel);
            _context.SaveChanges();

            return(supportTicketModel.TicketId);
        }
 public SupportTicket MapToDomain(SupportTicketModel supportTicketModel)
 {
     return new SupportTicket()
     {
         CreatedDate = supportTicketModel.CreatedDate,
         Subject = supportTicketModel.Subject,
         Message = supportTicketModel.Message,
         Status = supportTicketModel.Status,
         Type = supportTicketModel.Type,
         UserId = supportTicketModel.UserId
     };
 }
        public async Task <IActionResult> Post([FromBody] SupportTicketModel supportTicketModel)
        {
            long ticketId = 0; // initiate to 0

            if (ModelState.IsValid)
            {
                // Add date ticket raised before write to DB
                ticketId = _ticketServices.CreateTicket(supportTicketModel);
            }

            //return View(supportTicketModel);
            return(Ok(ticketId));
        }
Example #8
0
        public async Task <IActionResult> Create([Bind("TicketId,ProductId,AssignedEmployeeId,TicketTitle,TicketDetails,DateRaised,DateClosed,CustomerName,CustomerId,CustomerEmail")] SupportTicketModel supportTicketModel)
        {
            if (ModelState.IsValid)
            {
                // Add date ticket raised before write to DB
                supportTicketModel.DateRaised = DateTime.Now;

                _context.Add(supportTicketModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(supportTicketModel));
        }
        public string CreateSupportTicket(SupportTicketModel supportTicketModel)
        {
            try
            {
                var supportTicket = supportApi.CreateSupportTicket(supportTicketModel);
                supportApi.AddNewCardToSupport(supportTicket);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return "Support Ticket Created Successfully";
        }
        public SupportTicketModel UpdateTicketStatus(SupportTicketModel supportTicketModel)
        {
            var supportTicket = supportTicketRepository.Get(supportTicketModel.Id);
            supportTicket.Status = supportTicketModel.Status;
            supportTicketRepository.Save(supportTicket);

            return supportTicketMapper.MapToModel(supportTicket);
        }
 public SupportTicketModel UpdateTicketStatus(SupportTicketModel supportTicketModel)
 {
     return supportApi.UpdateTicketStatus(supportTicketModel);
 }