Ejemplo n.º 1
0
 public static Rating FromRating(IRating rating)
 {
     Rating r = new Rating
      {
     UserName = rating.UserName,
     Value = rating.Value,
     CreatedOn = rating.CreatedOn,
      };
      return r;
 }
Ejemplo n.º 2
0
 private void Save_Execute(object parameter)
 {
     if (m_isRatingDirty)
      {
     Rating rating = new Rating ();
     rating.CreatedOn = DateTime.Now;
     rating.UserName = Sellars.Meal.UI.Service.Impl.UserService.CurrentUser.Name;
     rating.Value = m_userRating.Value;
     #if !MultipleRatings
     Recipe.Ratings.Clear ();
     #endif
     Recipe.Ratings.Add (rating);
      }
      if (string.IsNullOrWhiteSpace(FileName))
      {
     var x = new Microsoft.Win32.SaveFileDialog();
     x.AddExtension = true;
     x.DefaultExt = ".recipe";
     x.FileName = Recipe.Name;
     x.Filter = "Recipe file|*.recipe";
     x.InitialDirectory = AppConfig.Instance.RecipePath;
     x.OverwritePrompt = true;
     x.ValidateNames = true;
     if (!x.ShowDialog ().Value)
        return;
     FileName = x.FileName;
      }
      var savedRecipe = Sellars.Meal.Svc.Persistance.Recipe.FromRecipe (Recipe);
      ServiceController.Get<IRecipeService> ().SaveRecipe (FileName, savedRecipe);
      Recipe = Sellars.Meal.UI.Model.Recipe.FromRecipe (savedRecipe);
      EditMode = false;
 }