public void Update(DalComment entity) { var propertyText = typeof(Comment).GetProperty("TextComment"); var comment = _context.Set<Comment>().Find(entity.Id); propertyText.SetValue(comment, entity.TextComment); _context.SaveChanges(); }
public void Create(DalComment e) { var art = _context.Set<Article>().Find(e.ArticleId); var c = new Comment() { TextComment = e.TextComment, Date = e.DateAdded, UserId = e.UserId }; art.Comments.Add(c); _context.SaveChanges(); }