public void Create(DalComment e) { var comment = new Comment() { TaskId=e.TaskId, UserId=e.UserId, Message=e.Message }; context.Set<Comment>().Add(comment); }
public void Delete(DalComment e) { var comment = new Comment() { CommentId = e.Id, TaskId=e.TaskId, UserId=e.UserId, Message=e.Message }; comment = context.Set<Comment>().Single(c => c.CommentId == c.CommentId); context.Set<Comment>().Remove(comment); }
public static void CopyFieldsTo(this DalComment source, Comment target) { if (source == null) { throw new ArgumentNullException("source"); } if (target == null) { throw new ArgumentNullException("target"); } target.UserId = source.UserId; target.Text = source.Text; target.ArticleId = source.ArticleId; }
public static Comment ToModel(this DalCommentEntity item) { if (item == null) return null; Comment comment = new Comment { Id = item.Id, Text = item.Text, ArticleId = item.Article.Id, Date = item.Date, UserId = item.User.Id }; return comment; }
public void Update(DalComment e) { var comment = new Comment() { CommentId = e.Id, TaskId = e.TaskId, UserId = e.UserId, Message = e.Message }; comment = context.Set<Comment>().Single(c => c.CommentId == comment.CommentId); context.Entry(comment).State = System.Data.Entity.EntityState.Modified; // throw new NotImplementedException(); }
public void UpdateComment(Comment comment) { _commentRepository.Update(comment); _uow.Commit(); }
public void CreateComment(Comment comment) { _commentRepository.Create(comment); _uow.Commit(); }