async public Task Post(PostRelated related) { //_context.ChangeTracker.TrackGraph(related,o => o.) CompletePost(related); related.Parent = await _context.Set <PostRelated>().FindAsync(related.Parent.Current.Id); await _context.AddAsync(related); await _context.SaveChangesAsync(); }
private void CompletePost(PostRelated related) { var user = related.Modifier = related.Current.Modifier = new CurrentUserValueGenerator(_accessor).Next(null); var date = related.ModifyDate = related.Current.ModifyDate = DateTimeOffset.Now; related.Creator = string.IsNullOrEmpty(related.Creator) ? user : related.Creator; related.Current.Creator = string.IsNullOrEmpty(related.Current.Creator) ? user : related.Current.Creator; related.CreateDate = related.CreateDate == default(DateTimeOffset) ? date : related.CreateDate; related.Current.CreateDate = related.Current.CreateDate == default(DateTimeOffset) ? date : related.Current.CreateDate; related.EndDate = DateTime.MaxValue; related.StartDate = DateTime.MinValue; }