public async Task <Product> GetAsync(Expression <Func <Product, bool> > expression) { var data = await _productDal.GetAsync(expression); data.Category = await _categoryDAL.GetAsync(a => a.CategoryId == data.CategoryId); data.Supplier = await _supplierDAL.GetAsync(a => a.SupplierId == data.SupplierId); return(data); }
public async Task <IResult> DeleteAsync(int id) { var category = await _categoryDAL.GetAsync(x => x.Id == id, x => x.ChildCategories); if (category.ChildCategories.Count > 0) { return(new ErrorResult(CRUDMessages.CantDeleteCauseOfChilds)); } _categoryDAL.Remove(category); await _uow.Complete(); return(new SuccessResult()); }
public async Task <Category> GetAsync(Expression <Func <Category, bool> > expression) { return(await _categoryDal.GetAsync(expression)); }