Example #1
0
 public bool GetComment(Guid id, out Comment comment)
 {
     comment = null;
     if (_db.IsContainComment(id))
     {
         comment = _db.GetComment(id);
         return true;
     }
     else
         return false;
 }
Example #2
0
        public void AddComment(User user, string text, int ball, Guid dish_id)
        {
            Dish dish = this.GetDish(dish_id);

            Comment comment = new Comment();
            comment.User = user;
            comment.Dish = dish;
            comment.Text = text;
            comment.Date = DateTime.Now;
            comment.Ball = ball;

            dish.Comments.Add(comment);

            dish.Rating = this.GetRating(dish);

            this.Entry<Dish>(dish).State = EntityState.Modified;
            this.Comments.Add(comment);

            _IsSavedOrModified = true;
        }
Example #3
0
        public void UpdateComment(Comment comment, string newText)
        {
            comment.Text = newText;

            this.Entry<Comment>(comment).State = EntityState.Modified;

            _IsSavedOrModified = true;
        }