diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-05-18 20:05:10 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-05-18 20:05:10 +0300 |
| commit | d91db45c47a1d2d1d050fdafe8f4eb44951a883f (patch) | |
| tree | 1437e1f0f7ea91dae53e59f7f605a3e603ea3926 /Software/Visual_Studio/Web | |
| parent | fd061c7cb7f243d562913d496223830bcf83b7a9 (diff) | |
| download | Tango-d91db45c47a1d2d1d050fdafe8f4eb44951a883f.tar.gz Tango-d91db45c47a1d2d1d050fdafe8f4eb44951a883f.zip | |
FSE/RSM MachineService Provides full capability.
Diffstat (limited to 'Software/Visual_Studio/Web')
7 files changed, 204 insertions, 46 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs index 383a59850..aea5da254 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs @@ -48,7 +48,7 @@ namespace Tango.MachineService.Controllers IHashGenerator hash = new BasicHashGenerator(); var password = hash.Encrypt(request.Password); - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == password).WithRolesAndPermissions().WithDeleted().Build(); @@ -98,7 +98,7 @@ namespace Tango.MachineService.Controllers ValidateCollectionAndKey(collection, key); - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { if (sn != null) { @@ -167,7 +167,7 @@ namespace Tango.MachineService.Controllers ValidateCollectionAndKey(item.Collection, item.Key); - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { if (item.MachineSerialNumber != null) { diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs index e65a8ebbc..b2de177aa 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs @@ -26,7 +26,7 @@ namespace Tango.MachineService.Controllers { List<DownloadModel> downloads = new List<DownloadModel>(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { foreach (var item in db.MachineStudioVersions.Where(x => x.InstallerBlobName != null).Include(x => x.User).Include(x => x.User.Contact).ToList()) { diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs index b7728af6a..c8b1628b1 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs @@ -33,7 +33,7 @@ namespace Tango.MachineService.Controllers if (reset != null) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var user = db.Users.SingleOrDefault(x => x.Guid == reset.UserGuid); diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs index cf03b367c..9df3a2d11 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs @@ -27,6 +27,7 @@ using System.Data.Entity; using static Tango.MachineService.Controllers.FSEController; using Tango.MachineService.Models; using Tango.BL.Enumerations; +using Tango.BL.DTO; namespace Tango.MachineService.Controllers { @@ -70,7 +71,7 @@ namespace Tango.MachineService.Controllers var password = hash.Encrypt(request.Password); - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == password).WithRolesAndPermissions().WithDeleted().Build(); @@ -124,6 +125,163 @@ namespace Tango.MachineService.Controllers } [HttpPost] + public GetUserResponse GetUser(GetUserRequest request) + { + using (var db = ObservablesWebContext.CreateContext()) + { + var user = new UserBuilder(db).Set(x => !x.Deleted && x.Email.ToLower() == request.Email.ToLower()) + .WithOrganization() + .WithRolesAndPermissions() + .Build(); + + if (user == null) throw new AuthenticationException("User not found."); + + var userDTO = UserDTO.FromObservable(user); + + return new GetUserResponse() { User = userDTO }; + } + } + + [HttpPost] + public GetMachineResponse GetMachine(GetMachineRequest request) + { + using (var db = ObservablesWebContext.CreateContext()) + { + Machine machine = null; + + if (request.GetExtendedInfo) + { + machine = new MachineBuilder(db) + .Set(x => (request.AllowAllMachines || x.OrganizationGuid == request.OrganizationGuid) && x.SerialNumber == request.SerialNumber) + .WithOrganization() + .WithVersion() + .WithSpools() + .WithConfiguration().Build(); + } + else + { + machine = new MachineBuilder(db) + .Set(x => (request.AllowAllMachines || x.OrganizationGuid == request.OrganizationGuid) && x.SerialNumber == request.SerialNumber) + .WithOrganization() + .Build(); + } + + if (machine != null) + { + return new GetMachineResponse() + { + Machine = MachineDTO.FromObservable(machine) + }; + } + + return new GetMachineResponse(); + } + } + + [HttpPost] + public GetEventTypesResponse GetEventTypes(GetEventTypesRequest request) + { + GetEventTypesResponse response = new GetEventTypesResponse(); + + using (ObservablesContext db = ObservablesWebContext.CreateContext()) + { + var eventTypes = db.EventTypes.ToList(); + response.EventTypes = eventTypes.Select(x => EventTypeDTO.FromObservable(x)).ToList(); + } + + return response; + } + + [HttpPost] + public GetProceduresResponse GetProcedures(GetProceduresRequest request) + { + GetProceduresResponse response = new GetProceduresResponse(); + + using (ObservablesContext db = ObservablesWebContext.CreateContext()) + { + var select = db.PublishedProcedureProjects + .Where(x => x.IsVisible || !request.GetOnlyVisible) + .Include(x => x.PublishedProcedureProjectsVersions) + .Select(x => new + { + Project = x, + LatestVersion = x.PublishedProcedureProjectsVersions.OrderByDescending(v => v.Version).FirstOrDefault() + }).ToList(); + + List<PublishedProcedureProject> projects = new List<PublishedProcedureProject>(); + + foreach (var p in select) + { + PublishedProcedureProject project = p.Project; + projects.Add(project); + } + + response.Projects = projects.Select(x => PublishedProcedureProjectDTO.FromObservable(x)).ToList(); + } + + return response; + } + + [HttpPost] + public GetTangoVersionsResponse GetTangoVersions(GetTangoVersionsRequest request) + { + GetTangoVersionsResponse response = new GetTangoVersionsResponse(); + + using (ObservablesContext db = ObservablesWebContext.CreateContext()) + { + var tangoVersions = db.TangoVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).ToList(); + + response.Versions = tangoVersions.Select(x => TangoVersionDTO.FromObservable(x)).ToList(); + } + + return response; + } + + [HttpPost] + public GetTechComponentsResponse GetTechComponents(GetTechComponentsRequest request) + { + GetTechComponentsResponse response = new GetTechComponentsResponse(); + + using (var db = ObservablesWebContext.CreateContext()) + { + if (request.Blowers) + { + response.Blowers = db.HardwareBlowerTypes.ToList().Select(x => HardwareBlowerTypeDTO.FromObservable(x)).ToList(); + } + if (request.Controllers) + { + response.Controllers = db.TechControllers.ToList().Select(x => TechControllerDTO.FromObservable(x)).ToList(); + } + if (request.Dispensers) + { + response.Dispensers = db.TechDispensers.ToList().Select(x => TechDispenserDTO.FromObservable(x)).ToList(); + } + if (request.Heaters) + { + response.Heaters = db.TechHeaters.ToList().Select(x => TechHeaterDTO.FromObservable(x)).ToList(); + } + if (request.IOs) + { + response.IOs = db.TechIos.ToList().Select(x => TechIoDTO.FromObservable(x)).ToList(); + } + if (request.Monitors) + { + response.Monitors = db.TechMonitors.ToList().Select(x => TechMonitorDTO.FromObservable(x)).ToList(); + } + if (request.Motors) + { + response.Motors = db.HardwareMotorTypes.ToList().Select(x => HardwareMotorTypeDTO.FromObservable(x)).ToList(); + } + if (request.Valves) + { + response.Valves = db.TechValves.ToList().Select(x => TechValveDTO.FromObservable(x)).ToList(); + } + } + + return response; + } + + [HttpPost] [JwtTokenFilter] public BugReportingInfoResponse GetBugReportInfo(BugReportingInfoRequest request) { @@ -141,7 +299,7 @@ namespace Tango.MachineService.Controllers { DownloadTangoVersionResponse response = new DownloadTangoVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var tangoVersion = db.TangoVersions.SingleOrDefault(x => x.Guid == request.TangoVersionGuid); @@ -198,7 +356,7 @@ namespace Tango.MachineService.Controllers { CheckForUpdatesResponse response = new CheckForUpdatesResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var versions = db.FseVersions.ToList().Where(x => x.BuildVariant == request.Build.ToInt32()).ToList(); @@ -254,7 +412,7 @@ namespace Tango.MachineService.Controllers { User user; - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { user = db.Users.Include(x => x.Contact).SingleOrDefault(x => x.Guid == request.UserGuid); @@ -295,7 +453,7 @@ namespace Tango.MachineService.Controllers { User user; - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { user = db.Users.Include(x => x.Contact).SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower()); @@ -344,7 +502,7 @@ namespace Tango.MachineService.Controllers [HttpPost] public LatestVersionResponse GetLatestVersion(LatestVersionRequest request) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var version = db.FseVersions.ToList().Where(x => x.BuildVariant == request.Build.ToInt32()).OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); return new LatestVersionResponse() { Version = version != null ? version.Version : "0.0.0.0" }; @@ -357,15 +515,15 @@ namespace Tango.MachineService.Controllers { UploadVersionResponse response = new UploadVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { String userID = RequestToken.Object.UserGuid; var user = new UserBuilder(db).Set(userID).WithRolesAndPermissions().Build(); if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersions)) - -{ + + { var latestVersion = db.FseVersions.ToList().Where(x => x.BuildVariant == request.Build.ToInt32()).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); Version local_version = Version.Parse(request.Version); @@ -415,7 +573,7 @@ namespace Tango.MachineService.Controllers { _pendingUploads.RemoveAll(x => x.Token == upload.Token); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { db.FseVersions.Add(new FseVersion() { diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs index dddb8cb38..782bef3a2 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs @@ -26,7 +26,7 @@ namespace Tango.MachineService.Controllers { IndexViewModel model = new IndexViewModel(); - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { int build = buildVariant.Value; diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs index 5f697f979..7eda111d0 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs @@ -77,7 +77,7 @@ namespace Tango.MachineService.Controllers CheckForUpdatesResponse response = new CheckForUpdatesResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var versions = db.MachineStudioVersions.ToList(); @@ -122,7 +122,7 @@ namespace Tango.MachineService.Controllers { DownloadLatestVersionResponse response = new DownloadLatestVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var versions = db.MachineStudioVersions.ToList(); @@ -160,7 +160,7 @@ namespace Tango.MachineService.Controllers { UploadVersionResponse response = new UploadVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { String userID = RequestToken.Object.UserGuid; @@ -231,7 +231,7 @@ namespace Tango.MachineService.Controllers { _pendingUploads.RemoveAll(x => x.Token == upload.Token); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { db.MachineStudioVersions.Add(new MachineStudioVersion() { @@ -261,7 +261,7 @@ namespace Tango.MachineService.Controllers [HttpPost] public LatestVersionResponse GetLatestVersion(LatestVersionRequest request) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var version = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); return new LatestVersionResponse() { Version = version != null ? version.Version : "0.0.0.0" }; @@ -317,7 +317,7 @@ namespace Tango.MachineService.Controllers throw new AuthenticationException($"You do not have permissions to access the {MachineServiceConfig.DEPLOYMENT_SLOT.ToDescription()} environment."); } - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { db.Roles.ToList(); db.Permissions.ToList(); @@ -385,7 +385,7 @@ namespace Tango.MachineService.Controllers { var password = hash.Encrypt(request.Password); - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && (isPasswordOK || x.Password == password)).WithRolesAndPermissions().WithDeleted().Build(); @@ -420,7 +420,7 @@ namespace Tango.MachineService.Controllers //Enforce Machine Studio Version ? if (MachineServiceConfig.ENFORCE_MACHINE_STUDIO_VERSION) { - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { var latest_version = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); @@ -468,7 +468,7 @@ namespace Tango.MachineService.Controllers { DownloadLatestPPCVersionResponse response = new DownloadLatestPPCVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber); diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 9cbc17abf..06b2fd232 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -68,7 +68,7 @@ namespace Tango.MachineService.Controllers LogManager.Log("Setup request received: " + request.ToString()); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { String machine_guid = RequestToken.Object.MachineGuid; @@ -177,7 +177,7 @@ namespace Tango.MachineService.Controllers Task.Factory.StartNew(() => { - using (ObservablesContext b = ObservablesContextHelper.CreateContext()) + using (ObservablesContext b = ObservablesWebContext.CreateContext()) { //Reset Job Runs. try @@ -216,7 +216,7 @@ namespace Tango.MachineService.Controllers DownloadUpdateResponse response = new DownloadUpdateResponse(); response.NotifyCompletedToken = Guid.NewGuid().ToString(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { db.Configuration.LazyLoadingEnabled = false; String machine_guid = RequestToken.Object.MachineGuid; @@ -302,7 +302,7 @@ namespace Tango.MachineService.Controllers { _pendingUpdates.Remove(pendingUpdate); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var tangoUpdate = db.TangoUpdates.SingleOrDefault(x => x.Guid == pendingUpdate.TangoUpdateGuid); @@ -333,7 +333,7 @@ namespace Tango.MachineService.Controllers { CheckForUpdateResponse response = new CheckForUpdateResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { String machine_guid = RequestToken.Object.MachineGuid; @@ -435,7 +435,7 @@ namespace Tango.MachineService.Controllers UpdateDBResponse response = new UpdateDBResponse(); response.NotifyCompletedToken = Guid.NewGuid().ToString(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { String machine_guid = RequestToken.Object.MachineGuid; @@ -506,7 +506,7 @@ namespace Tango.MachineService.Controllers UploadMachineDataResponse response = new UploadMachineDataResponse(); response.NotifyCompletedToken = Guid.NewGuid().ToString(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid); @@ -534,7 +534,7 @@ namespace Tango.MachineService.Controllers try { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid); @@ -547,7 +547,7 @@ namespace Tango.MachineService.Controllers //Insert/Replace Jobs. foreach (var dto in request.Jobs) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { try { @@ -586,7 +586,7 @@ namespace Tango.MachineService.Controllers //Insert Update DataStore Items foreach (var dto in request.DataStoreItems) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { try { @@ -626,7 +626,7 @@ namespace Tango.MachineService.Controllers //Insert JobRuns. foreach (var dto in request.JobRuns) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { try { @@ -654,7 +654,7 @@ namespace Tango.MachineService.Controllers //Insert TangoUpdates. foreach (var dto in request.OfflineUpdates) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { try { @@ -682,7 +682,7 @@ namespace Tango.MachineService.Controllers //Insert MachineEvents. foreach (var dto in request.MachineEvents) { - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { try { @@ -728,7 +728,7 @@ namespace Tango.MachineService.Controllers { DownloadMachineDataResponse response = new DownloadMachineDataResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid); @@ -795,7 +795,7 @@ namespace Tango.MachineService.Controllers { var response = new NotifyMachineDataDownloadCompletedResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid); @@ -837,7 +837,7 @@ namespace Tango.MachineService.Controllers { LatestVersionResponse response = new LatestVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var versions = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid && request.Tag == x.Tag).ToList(); @@ -863,7 +863,7 @@ namespace Tango.MachineService.Controllers { GetTagsResponse response = new GetTagsResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { var versions = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList(); @@ -884,7 +884,7 @@ namespace Tango.MachineService.Controllers { UploadVersionResponse response = new UploadVersionResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { //Load relations first... db.Roles.ToList(); @@ -974,7 +974,7 @@ namespace Tango.MachineService.Controllers { _pendingUploads.RemoveAll(x => x.Token == upload.Token); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { db.TangoVersions.Add(new TangoVersion() { @@ -1002,7 +1002,7 @@ namespace Tango.MachineService.Controllers [HttpPost] public MachineVersionsResponse GetMachineVersions(MachineVersionsRequest request) { - using (var db = ObservablesContextHelper.CreateContext()) + using (var db = ObservablesWebContext.CreateContext()) { return new MachineVersionsResponse() { @@ -1016,7 +1016,7 @@ namespace Tango.MachineService.Controllers { LoginResponse response = new LoginResponse(); - using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + using (ObservablesContext db = ObservablesWebContext.CreateContext()) { if (request.Mode == LoginMode.User) { |
