コード例 #1
0
        public void SaveVersion <T>(T cName, int UserId)
        {
            int          Version = 1;
            ReportFilter val     = (ReportFilter)(object)cName;

            var result = _db.ReportFilter_History.Where(i => i.FilterID == val.FilterID).OrderByDescending(x => x.Version).FirstOrDefault();

            Version = (result == null) ? 1 : result.Version + 1;

            ReportFilter_History rfHistory = new ReportFilter_History();

            val.CopyProperties(rfHistory);
            rfHistory.Version      = Version;
            rfHistory.ModifiedDate = DateTime.Now;
            rfHistory.UserId       = UserId;
            rfHistory.FilterID     = val.FilterID;


            _db.ReportFilter_History.Add(rfHistory);
            _db.SaveChanges();
        }