internal IProduct ToBll(Product source) { if (source == null) { return(null); } var target = _productFunctionality.ProductFactory(); target.Id = int.Parse(source.Id); target.Name = source.Name; target.Category = source.Category; target.DateAdded = source.DateAdded; target.Price = source.Price; return(target); }
public async Task <Product> CreateProduct(Product product) { ServiceContract.RequireNotNull(product, nameof(product)); ServiceContract.RequireValidated(product, nameof(product)); var bllProduct = ToBll(product); bllProduct = await _productFunctionality.CreateAsync(bllProduct); var result = FromBll(bllProduct); FulcrumAssert.IsNotNull(result, nameof(result)); FulcrumAssert.IsValidated(result, $"{Namespace}: 41042A82-2D71-427F-BBBF-9CDC7545E590"); return(result); }
public async Task <Product> UpdateProduct(Product product) { ServiceContract.RequireNotNull(product, nameof(product)); ServiceContract.RequireValidated(product, nameof(product)); var bllProduct = ToBll(product); bllProduct = await _productFunctionality.Update(bllProduct); var result = FromBll(bllProduct); FulcrumAssert.IsNotNull(result, nameof(result)); FulcrumAssert.IsValidated(result, $"{Namespace}: 27A74E83-C31A-4A87-B8C6-1FE5A7FF9F85"); return(result); }
internal Product FromBll(IProduct source) { if (source == null) { return(null); } #pragma warning disable IDE0017 // Simplify object initialization // ReSharper disable once UseObjectOrCollectionInitializer var target = new Product(); #pragma warning restore IDE0017 // Simplify object initialization target.Id = source.Id.ToString(); target.Name = source.Name; target.Category = source.Category; target.DateAdded = source.DateAdded; target.Price = source.Price; return(target); }
/// <summary> /// This is for testing purposes only. Converts a product object from Service contract to Business Logic contrace /// </summary> /// <param name="source"></param> /// <returns></returns> public object UnitTest_ToBll(Product source) { return(ToBll(source)); }