Пример #1
0
        private OuterInnerResourceSiteVersion MapVersions(OuterInnerResourceSite outerInnerResourceSite)
        {
            OuterInnerResourceSiteVersion outerInnerResourceSiteVersionVer = new OuterInnerResourceSiteVersion();

            outerInnerResourceSiteVersionVer.OuterInnerResourceId     = outerInnerResourceSite.OuterInnerResourceId;
            outerInnerResourceSiteVersionVer.MicrotingSdkCaseId       = outerInnerResourceSite.MicrotingSdkCaseId;
            outerInnerResourceSiteVersionVer.MicrotingSdkeFormId      = outerInnerResourceSite.MicrotingSdkeFormId;
            outerInnerResourceSiteVersionVer.OuterInnerResourceSiteId = outerInnerResourceSite.Id;
            outerInnerResourceSiteVersionVer.Version   = outerInnerResourceSite.Version;
            outerInnerResourceSiteVersionVer.CreatedAt = outerInnerResourceSite.CreatedAt;
            outerInnerResourceSiteVersionVer.UpdatedAt = outerInnerResourceSite.UpdatedAt;


            return(outerInnerResourceSiteVersionVer);
        }
Пример #2
0
        public async Task Delete(OuterInnerResourcePnDbContext dbContext)
        {
            OuterInnerResourceSite outerInnerResourceSite = dbContext.OuterInnerResourceSites.FirstOrDefault(x => x.Id == Id);

            if (outerInnerResourceSite == null)
            {
                throw new NullReferenceException($"Could not find machineArea with id: {Id}");
            }

            outerInnerResourceSite.WorkflowState = eForm.Infrastructure.Constants.Constants.WorkflowStates.Removed;

            if (dbContext.ChangeTracker.HasChanges())
            {
                outerInnerResourceSite.UpdatedAt = DateTime.Now;
                outerInnerResourceSite.Version  += 1;

                dbContext.OuterInnerResourceSiteVersions.Add(MapVersions(outerInnerResourceSite));
                dbContext.SaveChanges();
            }
        }
Пример #3
0
        public async Task Update(OuterInnerResourcePnDbContext dbContext)
        {
            OuterInnerResourceSite outerInnerResourceSite = dbContext.OuterInnerResourceSites.FirstOrDefault(x => x.Id == Id);

            if (outerInnerResourceSite == null)
            {
                throw new NullReferenceException($"Could not find machineArea with id: {Id}");
            }

            outerInnerResourceSite.OuterInnerResourceId = OuterInnerResourceId;
            outerInnerResourceSite.MicrotingSdkCaseId   = MicrotingSdkCaseId;
            outerInnerResourceSite.MicrotingSdkeFormId  = MicrotingSdkeFormId;
            outerInnerResourceSite.MicrotingSdkSiteId   = MicrotingSdkSiteId;

            if (dbContext.ChangeTracker.HasChanges())
            {
                outerInnerResourceSite.UpdatedAt = DateTime.Now;
                outerInnerResourceSite.Version  += 1;

                dbContext.OuterInnerResourceSiteVersions.Add(MapVersions(outerInnerResourceSite));
                dbContext.SaveChanges();
            }
        }