Example #1
0
 /// <summary>
 /// Adds a recention
 /// </summary>
 /// <param name="recention">The recention</param>
 public void AddRecension(IRecention recention)
 {
     using (var context = Connection.GetContext())
     {
         context.Recentions.Add(new Persistence.Recention()
         {
             AppID = recention.AppID,
             Comment = recention.Comment,
             Rating = recention.Rating,
             UserID = ID,
             Date = DateTime.Now
         });
         context.SaveChanges();
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RecentionViewModel"/> class.
 /// </summary>
 /// <param name="recention">The recention.</param>
 public RecentionViewModel(IRecention recention)
 {
     this.ID = recention.ID;
     this.Date = recention.Date;
     this.Comment = recention.Comment;
     this.AppID = recention.AppID;
     this.AppName = Facade.GetApp(recention.AppID).Name;
     this.Rating = recention.Rating;
     this.UserID = recention.UserID;
 }
Example #3
0
        /// <summary>
        /// Alters the contents of a recention
        /// </summary>
        /// <param name="recention">The recention</param>
        public void AlterRecention(IRecention recention)
        {
            using (var context = Connection.GetContext())
            {
                Persistence.Recention _recention = context.Recentions.SingleOrDefault(r => r.ID == recention.ID && r.UserID == this.ID);
                if (_recention != null)
                {
                    _recention.Rating = recention.Rating;
                    _recention.Comment = recention.Comment;
                    context.SaveChanges();
                }

            }
        }