Exemplo n.º 1
0
        public async Task <IHttpActionResult> Put(Guid uid, [FromBody] EditCategoryCommand editCategory)
        {
            editCategory.Uid = uid;

            return(await ProcessCommand(
                       command : () => Mediator.Send(editCategory),
                       paramValidators : RequestParamValidator.CategoryEditValidator(editCategory)));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Put(Guid?uid, [FromBody] EditProductCommand editProduct)
        {
            editProduct.Uid = uid.Value;

            return(await ProcessCommand(
                       command : () => Mediator.Send(editProduct),
                       paramValidators : RequestParamValidator.ProductEditValidator(editProduct)));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> AddToCategory(Guid?productid, Guid?categoryid)
        {
            var paramValidators = new[]
            {
                RequestParamValidator.ProductUidValidator(productid),
                RequestParamValidator.CategoryUidValidator(categoryid),
            };

            return(await ProcessCommand(
                       command : () => Mediator.Send(new AddProductToCategoryCommand(productid.Value, categoryid.Value)),
                       paramValidators : paramValidators));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> RemoveFromCategory(Guid productid, Guid categoryid)
        {
            var paramValidators = new[]
            {
                RequestParamValidator.ProductUidValidator(productid),
                RequestParamValidator.CategoryUidValidator(categoryid),
            };

            return(await ProcessCommand(
                       command : () => Mediator.Send(new RemoveProductFromCategoryCommand(productid, categoryid)),
                       paramValidators : paramValidators));
        }
Exemplo n.º 5
0
 public async Task <IHttpActionResult> Delete(Guid?uid)
 {
     return(await ProcessCommand(
                command : () => Mediator.Send(new DeleteCategoryCommand(uid.Value)),
                paramValidators : RequestParamValidator.CategoryUidValidator(uid)));
 }
Exemplo n.º 6
0
 public async Task <IHttpActionResult> Post([FromBody] AddCategoryRequest addCategory)
 {
     return(await ProcessRequest(
                request : () => Mediator.Send(addCategory),
                paramValidators : RequestParamValidator.CategoryAddValidator(addCategory)));
 }
Exemplo n.º 7
0
 public async Task <IHttpActionResult> Get(Guid?uid)
 {
     return(await ProcessRequest(
                request : () => Mediator.Send(new GetCategoryRequest(uid.Value)),
                paramValidators : RequestParamValidator.CategoryUidValidator(uid)));
 }
Exemplo n.º 8
0
 public async Task <IHttpActionResult> Post(AddProductRequest addProduct)
 {
     return(await ProcessRequest(
                request : () => Mediator.Send(addProduct),
                paramValidators : RequestParamValidator.ProductAddValidator(addProduct)));
 }
Exemplo n.º 9
0
 public async Task <IHttpActionResult> Details(Guid?uid)
 {
     return(await ProcessRequest(
                request : () => Mediator.Send(new GetProductDetailsRequest(uid.Value)),
                paramValidators : RequestParamValidator.ProductUidValidator(uid)));
 }