Example #1
0
        public override async Task <BusinessLogicEntity> Action(BusinessLogicEntity dto)
        {
            var entity = dto as Product;

            if ((await _data.GetProduct(entity.id)) != null)
            {
                AddError(string.Format("Product with Id={0} already exists", entity.id));
                return(null);
            }
            return(await _data.CreateProduct(entity));
        }
        public override async Task <BusinessLogicEntity> Action(BusinessLogicEntity dto)
        {
            var entity = dto as Product;

            if ((await _data.GetProduct(entity.id)) == null)
            {
                AddError(string.Format("Product with Id={0} doesn't exist", entity.id));
                return(null);
            }
            await _data.DeleteProduct(entity);

            return(entity);
        }