コード例 #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));
 }
コード例 #2
0
        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;
        }
コード例 #3
0
 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;
 }
コード例 #4
0
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
 public IngredientsRowWork(StockIngredientDTO ingredient, bool included)
     : this(ingredient)
 {
     Included = included;
 }