public int Add(ProductRegisterCommand productCmd) { var product = Mapper.Map <ProductRegisterCommand, Product>(productCmd); var newproduct = _repositoryProduct.Add(product); return(newproduct.Id); }
public int Add(ProductRegisterCommand command) { var product = Mapper.Map <ProductRegisterCommand, Product>(command); var newProduct = _productRepository.Add(product); return(newProduct.Id); }
public static ProductRegisterCommand ProductCommandToRegister() { ProductRegisterCommand product = new ProductRegisterCommand(); product.Code = "ABY-Y7ASA"; product.Description = "Bolacha Maria"; product.UnitaryValue = 10.00; return(product); }
public IHttpActionResult Post(ProductRegisterCommand productCmd) { var validator = productCmd.Validate(); if (!validator.IsValid) { return(HandleValidationFailure(validator.Errors)); } return(HandleCallback(_productService.Add(productCmd))); }