コード例 #1
0
 public void UpdateBook(BookViewModel bookViewModel)
 {
     FlaggedBook flaggedBook = this.GetFlaggedBooksForUser().FirstOrDefault(b => b.BookId == bookViewModel.Id);
     if (flaggedBook == null)
     {
         flaggedBook = new FlaggedBook();
         flaggedBook.ProfileId = 1;
         flaggedBook.BookId = bookViewModel.Id;
         flaggedBook.Rating = bookViewModel.Rating;
         flaggedBook.IsFlaggedToRead = bookViewModel.Rating == 0 ? 1 : 0;
         DbContext.FlaggedBooks.Add(flaggedBook);
     }
     else
     {
         flaggedBook.Rating = bookViewModel.Rating;
         flaggedBook.IsFlaggedToRead = bookViewModel.Rating == 0 ? 1 : 0;
     }
     DbContext.SaveChanges();
     FlaggedBooksForUser = null;
 }
コード例 #2
0
ファイル: BigShelf.Designer.cs プロジェクト: nuxleus/WCFWeb
 /// <summary>
 /// Deprecated Method for adding a new object to the FlaggedBooks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFlaggedBooks(FlaggedBook flaggedBook)
 {
     base.AddObject("FlaggedBooks", flaggedBook);
 }
コード例 #3
0
ファイル: BigShelf.Designer.cs プロジェクト: nuxleus/WCFWeb
 /// <summary>
 /// Create a new FlaggedBook object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="profileId">Initial value of the ProfileId property.</param>
 /// <param name="bookId">Initial value of the BookId property.</param>
 /// <param name="rating">Initial value of the Rating property.</param>
 /// <param name="isFlaggedToRead">Initial value of the IsFlaggedToRead property.</param>
 public static FlaggedBook CreateFlaggedBook(global::System.Int32 id, global::System.Int32 profileId, global::System.Int32 bookId, global::System.Int32 rating, global::System.Int32 isFlaggedToRead)
 {
     FlaggedBook flaggedBook = new FlaggedBook();
     flaggedBook.Id = id;
     flaggedBook.ProfileId = profileId;
     flaggedBook.BookId = bookId;
     flaggedBook.Rating = rating;
     flaggedBook.IsFlaggedToRead = isFlaggedToRead;
     return flaggedBook;
 }
コード例 #4
0
 public BookViewModel()
 {
     Book = new Book();
     FlaggedBook = new FlaggedBook();
 }