/// <summary> /// Get the children Baskets and assign them to basket.Products /// </summary> /// <param name="basket"> /// The Parent /// </param> public void GetBasket( Core.Domain.Product product) { if (product != null) { product.Basket = _dataSet.Baskets.Where(m => m.Id == product.BacketId).FirstOrDefault(); } }
/// <summary> /// Get the parent Basket for product and assign it the product.Backet. /// </summary> public void Get(Core.Domain.Product product) { if (product == null) { return; } product.Basket = UnitOfWork.DataSet.Baskets .SingleOrDefault(x => x.Id == product.BacketId); }
public DataStoreResult Delete(Core.Domain.Product product) { var model = _dataSet.Products .SingleOrDefault(x => x.Id == product.Id); if (model != null) { _dataSet.Products.Remove(model); } return(DataStoreResult.Success); }
public bool Add(Core.Domain.Product entity) { if (entity == null) { return(false); } entity.CreatedDate = DateTime.Now; _unitOfWork.Add(entity); return(true); }
public DataStoreResult Remove(Core.Domain.Product entity, out string errorMessage) { errorMessage = ""; if (entity == null) { errorMessage = ""; return(DataStoreResult.Success); } return(_unitOfWork.Delete(entity)); }
public void Add(Product core) { if (core == null) { return; } Core.Domain.Product product = null; if (core.Id != null) { product = _dataSet.Products.SingleOrDefault(x => x.Id == core.Id); } if (product == null) { // Add the new invoice _dataSet.Products.Add(core); } else { product.Update(core); } }