public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) { if ((source != null) && (target != null)) { target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed; } }
public static HiveExperiment ToEntity(DT.HiveExperiment source) { if (source == null) { return(null); } var entity = new HiveExperiment(); ToEntity(source, entity); return(entity); }
public static DT.HiveExperiment ToDto(HiveExperiment source) { if (source == null) { return(null); } return(new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed }); }
public Permission GetPermissionForExperiment(Guid experimentId, Guid userId) { using (var db = CreateContext()) { HiveExperiment hiveExperiment = db.HiveExperiments.SingleOrDefault(x => x.HiveExperimentId == experimentId); if (hiveExperiment == null) { return(Permission.NotAllowed); } if (hiveExperiment.OwnerUserId == userId) { return(Permission.Full); } HiveExperimentPermission permission = db.HiveExperimentPermissions.SingleOrDefault(p => p.HiveExperimentId == experimentId && p.GrantedUserId == userId); return(permission != null ? permission.Permission : Permission.NotAllowed); } }
public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) { if ((source != null) && (target != null)) { target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed; } }
public static HiveExperiment ToEntity(DT.HiveExperiment source) { if (source == null) return null; var entity = new HiveExperiment(); ToEntity(source, entity); return entity; }
public static DT.HiveExperiment ToDto(HiveExperiment source) { if (source == null) return null; return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed }; }