Ejemplo n.º 1
0
 private site_versions MapSiteVersions(sites site)
 {
     return(new site_versions
     {
         WorkflowState = site.WorkflowState,
         Version = site.Version,
         CreatedAt = site.CreatedAt,
         UpdatedAt = site.UpdatedAt,
         MicrotingUid = site.MicrotingUid,
         Name = site.Name,
         SiteId = site.Id
     });
 }
Ejemplo n.º 2
0
        public async Task Delete(MicrotingDbContext dbContext)
        {
            sites site = await dbContext.sites.FirstOrDefaultAsync(x => x.Id == Id);

            if (site == null)
            {
                throw new NullReferenceException($"Could not find Site with Id: {Id}");
            }

            site.WorkflowState = Constants.Constants.WorkflowStates.Removed;

            if (dbContext.ChangeTracker.HasChanges())
            {
                site.Version  += 1;
                site.UpdatedAt = DateTime.UtcNow;

                dbContext.site_versions.Add(MapSiteVersions(site));
                await dbContext.SaveChangesAsync().ConfigureAwait(false);
            }
        }