Redid some of the surface editor and started working on layout saving

This commit is contained in:
SpoinkyNL committed 2019-09-18 22:26:10 +02:00
1 parent 81294eef8f
commit 71f53c0833
48 files changed
+1012 -107

No files matched your search

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Models.Surface;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Repositories.Interfaces;
namespace Artemis.Core.Services.Storage
{
public class SurfaceService : ISurfaceService
{
private readonly ISurfaceRepository _surfaceRepository;
public SurfaceService(ISurfaceRepository surfaceRepository)
{
_surfaceRepository = surfaceRepository;
}
public async Task<List<SurfaceConfiguration>> GetSurfaceConfigurations()
{
var surfaceEntities = await _surfaceRepository.GetAllAsync();
var configs = new List<SurfaceConfiguration>();
foreach (var surfaceEntity in surfaceEntities)
configs.Add(new SurfaceConfiguration(surfaceEntity));
return configs;
}
public SurfaceConfiguration GetActiveSurfaceConfiguration()
{
var entity = _surfaceRepository.GetAll().FirstOrDefault(d => d.IsActive);
return entity != null ? new SurfaceConfiguration(entity) : null;
}
}
public interface ISurfaceService : IArtemisService
{
Task<List<SurfaceConfiguration>> GetSurfaceConfigurations();
SurfaceConfiguration GetActiveSurfaceConfiguration();
}
}