Exemplo n.º 1
0
        public async Task <ActionResult <Unit> > Delete(Guid id)
        {
            MediatR.Unit deleteActivity = await _mediator.Send(new Delete.Command {
                Id = id
            });

            return(deleteActivity);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Unit> > Edit(Guid id, Edit.Command command)
        {
            command.Id = id;

            MediatR.Unit unit = await _mediator.Send(command);

            return(unit);
        }
Exemplo n.º 3
0
        protected async Task <IActionResult> _delete <TCommand>(TCommand command)
            where TCommand : class, IDeleteCommand <TEntity, TType>, new()
        {
            try
            {
                MediatR.Unit result = await _mediator.Send(command);

                return(new ObjectResult(result));
            }
            catch (ArgumentNullException ex)
            {
                return(NotFound(ex));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Exemplo n.º 4
0
        public async Task <ActionResult <Unit> > Create(Create.Command command)
        {
            MediatR.Unit createActivity = await _mediator.Send(command);

            return(createActivity);
        }