commit 87e9a7c921deb074dfd535c80ad0a4fbeee613ee
Author: Silentkiller159 <milanhotovec@seznam.cz>
Date:   Thu May 13 22:57:43 2021 +0200

    Global definition area Repo prepared

diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IGlobalDefinitionAreaRepository.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IGlobalDefinitionAreaRepository.cs
index 8610852..db416ef 100644
--- a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IGlobalDefinitionAreaRepository.cs
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IGlobalDefinitionAreaRepository.cs
@@ -1,4 +1,5 @@
-﻿using System;
+﻿using Leuze.Modules.Goal.Domain.Domains;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -8,5 +9,19 @@ namespace Leuze.Modules.Goal.Domain.Repositories
 {
     public interface IGlobalDefinitionAreaRepository
     {
+        Task<bool> AddAsync(GlobalDefinitionArea gdArea);
+
+        Task<bool> RemoveAsync(Guid id);
+
+        Task<GlobalDefinitionArea> GetByIdAsync(Guid id);
+
+        Task<List<GlobalDefinitionArea>> GetAllAsync();
+
+        Task<bool> SetFrom(Guid id, DateTime from);
+
+        Task<bool> SetTo(Guid id, DateTime to);
+
+        Task<bool> SetCompanyVariSetVariCompanySuccess(Guid id, double vari);
+
     }
 }
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs
index 0d3fe34..150f3f7 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs
@@ -3,6 +3,7 @@ using ExtCore.Data.Abstractions;
 using Leuze.Core.Infrastructure.Persistence;
 using Leuze.Modules.Goal.Domain.Domains;
 using Leuze.Modules.Goal.Domain.Repositories;
+using Microsoft.EntityFrameworkCore;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -43,12 +44,12 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 
         public async Task<List<Comment>> GetAllForGoalAsync(Guid goalId)
         {
-            return dbSet.Where(item => item.GoalId == goalId).ToList(); //TODO: await??
+            return await dbSet.Where(item => item.GoalId == goalId).ToListAsync();
         }
 
         public async Task<List<Comment>> GetAllAsync()
         {
-            return dbSet.ToList(); //TODO: Await??
+            return await dbSet.ToListAsync();
         }
 
         public async Task<bool> EditAsync(Guid id, string text)
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GlobalDefinitionAreaRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GlobalDefinitionAreaRepository.cs
index 3d3bf3b..8330f21 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GlobalDefinitionAreaRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GlobalDefinitionAreaRepository.cs
@@ -1,4 +1,7 @@
-﻿using Leuze.Modules.Goal.Domain.Repositories;
+﻿using ExtCore.Data.EntityFramework;
+using Leuze.Modules.Goal.Domain.Domains;
+using Leuze.Modules.Goal.Domain.Repositories;
+using Microsoft.EntityFrameworkCore;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -7,7 +10,62 @@ using System.Threading.Tasks;
 
 namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 {
-    class GlobalDefinitionAreaRepository : IGlobalDefinitionAreaRepository
+    class GlobalDefinitionAreaRepository : RepositoryBase<GlobalDefinitionArea>, IGlobalDefinitionAreaRepository
     {
+        public async Task<bool> AddAsync(GlobalDefinitionArea gdArea)
+        {
+            await dbSet.AddAsync(gdArea);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<List<GlobalDefinitionArea>> GetAllAsync()
+        {
+            return await dbSet.ToListAsync();
+        }
+
+        public async Task<GlobalDefinitionArea> GetByIdAsync(Guid id)
+        {
+            return await dbSet.FindAsync(id);
+        }
+
+        public async Task<bool> RemoveAsync(Guid id)
+        {
+            GlobalDefinitionArea item = await GetByIdAsync(id);
+            if (item == null)
+            {
+                return false;
+            }
+            dbSet.Remove(item);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetCompanyVariSetVariCompanySuccess(Guid id, double vari)
+        {
+            GlobalDefinitionArea item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.SetVariCompanySuccess(vari);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetFrom(Guid id, DateTime from)
+        {
+            GlobalDefinitionArea item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.SetFrom(from);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetTo(Guid id, DateTime to)
+        {
+            GlobalDefinitionArea item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.SetTo(to);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
     }
 }
