public async Task CreateProduct(CreateProductInput input) { var product = input.MapTo <Product>(); product.ServiceTags = string.Join(",", input.Tags); await _productRepository.InsertAsync(product); }
public async Task <GetProductOutput> Create(CreateProductInput input) { var product = input.MapTo <Product>(); product = await _productDomainService.Create(product); return(product.MapTo <GetProductOutput>()); }
public async Task <CreateProductOutput> CreateProduct(CreateProductInput input) { var produto = input.MapTo <Product>(); var createdProdutoId = await _productManager.Create(produto); return(new CreateProductOutput { Id = createdProdutoId }); }
public virtual async Task UpdateProduct(CreateProductInput input) { using (_unitOfWorkManager.Current.SetTenantId(_session.TenantId)) { input.TenantId = (int)_session.TenantId; var Product = input.MapTo <Product>(); var query = _ProductRepository.GetAll() .Where(p => (p.ProductCode == input.ProductCode || p.ProductName == input.ProductName) && p.Id != input.Id).FirstOrDefault(); if (query == null) { await _ProductRepository.UpdateAsync(Product); } else { throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in Product ..."); } } }