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

            return(deleteActivity);
        }
Example #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);
        }
Example #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));
            }
        }
Example #4
0
        public async Task <ActionResult <Unit> > Create(Create.Command command)
        {
            MediatR.Unit createActivity = await _mediator.Send(command);

            return(createActivity);
        }