Spontaneous.DataModel.Dish.CopyFrom C# (CSharp) Method

CopyFrom() public method

public CopyFrom ( Dish copyFrom ) : void
copyFrom Dish
return void
        public void CopyFrom(Dish copyFrom)
        {
            this.Description = copyFrom.Description;
            if (copyFrom.LocalizedDescription != null) this.LocalizedDescription = copyFrom.LocalizedDescription;
            this.DishState = copyFrom.DishState;
            this.CreatedAt = copyFrom.CreatedAt;
            this.UpdatedAt = copyFrom.UpdatedAt;
            this.Name = copyFrom.Name;
            if (copyFrom.LocalizedName != null) this.LocalizedName = copyFrom.LocalizedName;
            this.NutritionFacts = copyFrom.NutritionFacts;
            this.ItemLocation = copyFrom.ItemLocation;
            this.Image = copyFrom.Image;
            this.Images = copyFrom.Images;
            this.ImageUrl = copyFrom.ImageUrl;
            this.IsItPublic = copyFrom.IsItPublic;
            this.MappedState = copyFrom.MappedState;
            this.RecipeId = copyFrom.RecipeId;
            this.State = copyFrom.State;
            this.OverrideIngredients = copyFrom.OverrideIngredients;
        }

Usage Example

Example #1
0
 /// <summary>
 /// Function copy partial MenuPart (dishes which Ids in CopyList)
 /// </summary>
 /// <param name="copyList"></param>
 /// <param name="copyFrom"></param>
 public void CopyPartialMenuPart(CopyList copyList, MenuPart copyFrom)
 {
     int tempDishId;
     //count of dishes to copy
     int copyCount = copyList.MenuPartsCopyList[0].DishesIdsList.Count;
     for (int i = 0; i < copyCount; i++)
     {
         tempDishId = copyList.MenuPartsCopyList[0].DishesIdsList[i];
         Dish tempDish = new Dish();
         tempDish.CopyFrom(copyFrom.Dishes.FirstOrDefault(c => c.Id == tempDishId));
         tempDish.Id = this.MaxDishId() + 1;
         tempDish.OrderBy = tempDish.Id;
         this.Dishes.Add(tempDish);
     }
 }
All Usage Examples Of Spontaneous.DataModel.Dish::CopyFrom