Пример #1
0
        public static RecipePart FromRecipePart(IRecipePart recipePart)
        {
            RecipePart r = new RecipePart
            {
                Name = recipePart.Name,
                PreparationMethod = recipePart.PreparationMethod == null ? null : Tag.FromTag(recipePart.PreparationMethod),
                PreparationTime   = recipePart.PreparationTime,
                CookTime          = recipePart.CookTime,
                ChillTime         = recipePart.ChillTime,
                Temperature       = recipePart.Temperature,
                Ingredients       = new ObservableCollection <IngredientDetail> (recipePart.Ingredients.Select <IIngredientDetail, IngredientDetail>(IngredientDetail.FromIngredientDetail)),
                Instructions      = recipePart.Instructions,
            };

            if (recipePart.Comments != null)
            {
                r.Comments = new ObservableCollection <IComment> (recipePart.Comments.Select <IComment, Comment>(Comment.FromComment).Cast <IComment> ());
            }
            return(r);
        }
Пример #2
0
 public static RecipePart FromRecipePart(IRecipePart recipePart)
 {
     RecipePart r = new RecipePart
      {
     Name = recipePart.Name,
     PreparationMethod = recipePart.PreparationMethod == null ? null : Tag.FromTag (recipePart.PreparationMethod),
     PreparationTime = recipePart.PreparationTime,
     CookTime = recipePart.CookTime,
     ChillTime = recipePart.ChillTime,
     Temperature = recipePart.Temperature,
     Ingredients = new ObservableCollection<IngredientDetail> ( recipePart.Ingredients.Select<IIngredientDetail,IngredientDetail>(IngredientDetail.FromIngredientDetail)),
     Instructions = recipePart.Instructions,
      };
      if (recipePart.Comments != null)
     r.Comments = new ObservableCollection<IComment> (recipePart.Comments.Select<IComment,Comment>(Comment.FromComment).Cast<IComment> ());
      return r;
 }