示例#1
0
        public bool Add(IIngredientContainerDAL containerDAL = null)
        {
            Ingredient i = new IngredientContainer(containerDAL).FindByName(this.Name);

            if (ExistsInDatabase(this.Name, containerDAL))
            {
                return(false);
            }

            if (this.Diet != 0 && this.Diet != 1 && this.Diet != 2)
            {
                return(false);
            }

            return(ingredientDAL.Add(this.Name, this.Diet));
        }
示例#2
0
        private bool ExistsInDatabase(string name, IIngredientContainerDAL containerDAL = null)
        {
            Ingredient i = new IngredientContainer(containerDAL).FindByName(name);

            return(i != null);
        }