public async Task <IActionResult> Reply(ReplyTicketCommand command, bool isClosed)
        {
            try
            {
                if (User.IsInRole("admin"))
                {
                    command.Close = isClosed;
                }
                await Mediator.Send(command);
            }
            catch (ValidationException exception)
            {
                foreach (var(key, value) in exception.Errors)
                {
                    foreach (var singleValue in value)
                    {
                        ModelState.AddModelError(key, singleValue);
                    }
                }
            }
            catch (NotFoundException exception)
            {
                return(NotFound(exception.Message));
            }

            return(RedirectToAction("Details", new { id = command.TicketId }));
        }
Beispiel #2
0
        public async Task <IActionResult> Update(ReplyTicketCommand replyTicketCommand)
        {
            var result = await Mediator.Send(replyTicketCommand);

            if (result.Success == false)
            {
                return(result.ApiResult);
            }

            return(NoContent());
        }
Beispiel #3
0
 public async Task <ActionResult <int> > Reply(ReplyTicketCommand command)
 {
     return(await Mediator.Send(command));
 }