示例#1
0
 public void Ingredient_DeleteTest()
 {
     StockIngredientDTO st = new StockIngredientDTO { StockQuantity = 1, PricePerUnit = 0.1M, NormalWeight = 1, Name = "ING", ExtraWeight = 2, IsPartOfRecipe=false };
     Assert.IsNotNull(removeStockItemIngredient(st));
     st.IsPartOfRecipe = true;
     Assert.IsNull(removeStockItemIngredient(st));
 }
        public void UpdateIngredient(Ingredient ing, StockIngredientDTO dto)
        {
            if (ing.IngredientID != dto.IngredientID)
                return;

            ing.ExtraWeight = dto.ExtraWeight;
            ing.Name = dto.Name;
            ing.NormalWeight = dto.NormalWeight;
            ing.PricePerUnit = dto.PricePerUnit;
        }
 public IngredientsRowWork(StockIngredientDTO ingredient)
 {
     Ingredient = new OrderIngredientDTO
     {
         Quantity = ingredient.NormalWeight,
         Price = ingredient.PricePerUnit,
         NormalWeight = ingredient.NormalWeight,
         Name = ingredient.Name,
         IngredientID = ingredient.IngredientID,
         ExtraWeight = ingredient.ExtraWeight
     };
     Included = false;
 }
        public StockIngredientDTO ToSimpleDto(Ingredient ing)
        {
            StockIngredientDTO ingDto = new StockIngredientDTO
            {
                ExtraWeight = ing.ExtraWeight,
                IngredientID = ing.IngredientID,
                Name = ing.Name,
                NormalWeight = ing.NormalWeight,
                PricePerUnit = ing.PricePerUnit,
                StockQuantity = ing.StockQuantity,
                IsPartOfRecipe = ing.Recipies != null
            };

            return ingDto;
        }
        public Ingredient ToEntityWithEmptyRecipies(StockIngredientDTO ing)
        {
            Ingredient ingDto = new Ingredient
            {
                ExtraWeight = ing.ExtraWeight,
                IngredientID = ing.IngredientID,
                Name = ing.Name,
                NormalWeight = ing.NormalWeight,
                PricePerUnit = ing.PricePerUnit,
                StockQuantity = ing.StockQuantity,
                Recipies = new List<Recipe>()
            };

            return ingDto;
        }
 public IngredientsRowWork(StockIngredientDTO ingredient, bool included)
     : this(ingredient)
 {
     Included = included;
 }