public void Delete(int id) { TasksComment comment = _Context.TasksComments.FirstOrDefault(x => x.Id == id); if (comment != null) { // TODO: Переодически чистить удаленные записи и перестраивать индексы comment.IsDeleted = true; _Context.SubmitChanges(); } }
public void Add(ITask task, IUser author, string comment, int?parentId, string parrentComment) { TasksComment tasksComment = new TasksComment { AuthorUser = author.Nick, BoardId = task.BoardId, AuthorUserId = author.Id, Comment = comment.TrimEnd(), CreationDate = DateTimeOffset.Now, ParentComment = parrentComment ?? "", ParentId = parentId, IsDeleted = false, TaskId = task.Id }; _Context.TasksComments.InsertOnSubmit(tasksComment); _Context.SubmitChanges(); }