public async Task <Product> InsertProductAsync(Product.ProductBuilder builder) { if (builder == null) { Notification.Raise(Notification .DefaultBuilder .AsError() .FromErrorEnum(Error.DomainServiceOnInsertAndGetIdNullBuilderError) .WithMessage(DomainConstants.LocalizationSourceName, Error.DomainServiceOnInsertAndGetIdNullBuilderError) .Build()); return(default(Product)); } var product = builder.Build(); if (Notification.HasNotification()) { return(default(Product)); } product.Id = await repository.InsertProductAndGetIdAsync(product); return(product); }
public Task <Product> UpdateProductAsync(Product.ProductBuilder builder) { var entity = builder.Build(); if (notificationHandler.HasNotification()) { return(Task.FromResult <Product>(null)); } list.RemoveAll(c => c.Id == entity.Id); list.Add(entity); return(entity.AsTask()); }
public Task <Product> InsertProductAsync(Product.ProductBuilder builder) { var entity = builder.Build(); if (notificationHandler.HasNotification()) { return(Task.FromResult <Product>(null)); } entity.Id = Guid.NewGuid(); list.Add(entity); return(entity.AsTask()); }