public async Task <Product> InsertProductAsync(Product.Builder builder) { if (builder == null) { Notification .DefaultBuilder .AsError() .FromErrorEnum(Error.DomainServiceOnInsertNullBuilderError) .WithMessage(Constants.LocalizationSourceName, Error.DomainServiceOnInsertNullBuilderError) .Raise(); return(default(Product)); } var product = builder.Build(); if (Notification.HasNotification()) { return(default(Product)); } product = await _repository.InsertProductAndGetIdAsync(product); return(product); }
public Task <Product> UpdateProductAsync(Product.Builder 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.Builder builder) { var entity = builder.Build(); if (notificationHandler.HasNotification()) { return(Task.FromResult <Product>(null)); } entity.Id = Guid.NewGuid(); list.Add(entity); return(entity.AsTask()); }
public async Task <Product> UpdateProductAsync(Product.Builder builder) { if (builder == null) { Notification.RaiseError(Constants.LocalizationSourceName, Error.DomainServiceOnUpdateNullBuilderError); return(default(Product)); } var product = builder.Build(); if (Notification.HasNotification()) { return(default(Product)); } return(await _repository.UpdateProductAsync(product)); }