diff --git a/DAL/App.config b/DAL/App.config
new file mode 100644
index 0000000..7e1d79c
--- /dev/null
+++ b/DAL/App.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
new file mode 100644
index 0000000..3a3287a
--- /dev/null
+++ b/DAL/DAL.csproj
@@ -0,0 +1,62 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {B783887A-E5BB-4066-9B9B-ABD7B4C1E269}
+ Library
+ Properties
+ DAL
+ DAL
+ v4.5.2
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DAL/Domain/Foorum.cs b/DAL/Domain/Foorum.cs
new file mode 100644
index 0000000..35c8f8f
--- /dev/null
+++ b/DAL/Domain/Foorum.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+
+namespace DAL.Domain
+{
+ public class Foorum
+ {
+ [Key]
+ public int FoorumId { get; set; }
+ public string Title { get; set; }
+ public string Description { get; set; }
+ public string Body { get; set; }
+ public DateTime CreationTime { get; set; }
+ public string Author { get; set; }
+
+ public bool Visible { get; set; } = true;
+
+ public virtual List Posts {get; set;} = new List();
+
+ }
+}
diff --git a/DAL/Domain/Post.cs b/DAL/Domain/Post.cs
new file mode 100644
index 0000000..8988174
--- /dev/null
+++ b/DAL/Domain/Post.cs
@@ -0,0 +1,16 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+
+namespace DAL.Domain
+{
+ public class Post
+ {
+ [Key]
+ public int PostId { get; set; }
+ public string Title { get; set; }
+ public string Body { get; set; }
+ public DateTime CreationTime { get; set; }
+ public string Author { get; set; }
+
+ }
+}
diff --git a/DAL/FoorumDbContext.cs b/DAL/FoorumDbContext.cs
new file mode 100644
index 0000000..1b4d1e7
--- /dev/null
+++ b/DAL/FoorumDbContext.cs
@@ -0,0 +1,21 @@
+using System.Data.Entity;
+using DAL.Domain;
+
+namespace DAL
+{
+ public class FoorumDbContext : DbContext, Interfaces.IFoorumDbContext
+ {
+ public DbSet Foorums { get; set; }
+ public DbSet Posts { get; set; }
+
+
+
+ public FoorumDbContext() : base("name=FoorumDb")
+ {
+ Database.SetInitializer(
+ new Helpers.DbInitializer()
+ );
+ }
+
+ }
+}
diff --git a/DAL/Helpers/DbInitializer.cs b/DAL/Helpers/DbInitializer.cs
new file mode 100644
index 0000000..1201d1b
--- /dev/null
+++ b/DAL/Helpers/DbInitializer.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Data.Entity;
+using DAL.Domain;
+
+
+namespace DAL.Helpers
+{
+ public class DbInitializer : DropCreateDatabaseAlways
+ {
+ protected override void Seed(FoorumDbContext ctx)
+ {
+
+ var foorum = new Foorum()
+ {
+ Title = "Test Foorum",
+ Author = "Kala",
+ Description = "Lühi kirjeldus",
+ Body = "Siia kirjutame pika teksti",
+ CreationTime = DateTime.Now,
+ Visible = true
+
+ };
+ ctx.Foorums.Add(foorum);
+
+
+ for (int i = 0; i < 3; i++)
+ {
+ var post = new Post()
+ {
+ Title = $"Post {i}",
+ Author = "Karu",
+ Body = $"Pikk sisu {i}",
+ CreationTime = DateTime.Now
+ };
+ ctx.Posts.Add(post);
+ foorum.Posts.Add(post);
+ }
+
+
+ ctx.SaveChanges();
+ }
+ }
+}
diff --git a/DAL/Interfaces/IFoorumDbContext.cs b/DAL/Interfaces/IFoorumDbContext.cs
new file mode 100644
index 0000000..362c8ec
--- /dev/null
+++ b/DAL/Interfaces/IFoorumDbContext.cs
@@ -0,0 +1,7 @@
+namespace DAL.Interfaces
+{
+ interface IFoorumDbContext
+ {
+
+ }
+}
diff --git a/DAL/Properties/AssemblyInfo.cs b/DAL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..b344edc
--- /dev/null
+++ b/DAL/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("DAL")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DAL")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b783887a-e5bb-4066-9b9b-abd7b4c1e269")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DAL/packages.config b/DAL/packages.config
new file mode 100644
index 0000000..4409173
--- /dev/null
+++ b/DAL/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Foorum.sln b/Foorum.sln
index ad7ba43..3ccea43 100644
--- a/Foorum.sln
+++ b/Foorum.sln
@@ -1,10 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26510.0
+VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Foorum", "Foorum\Foorum.csproj", "{D4668470-A7AB-4F03-912A-BE9187967E36}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{69C81CEE-28DC-4B57-B9B5-F8CDE8E22750}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{D4668470-A7AB-4F03-912A-BE9187967E36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4668470-A7AB-4F03-912A-BE9187967E36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4668470-A7AB-4F03-912A-BE9187967E36}.Release|Any CPU.Build.0 = Release|Any CPU
+ {69C81CEE-28DC-4B57-B9B5-F8CDE8E22750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {69C81CEE-28DC-4B57-B9B5-F8CDE8E22750}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {69C81CEE-28DC-4B57-B9B5-F8CDE8E22750}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {69C81CEE-28DC-4B57-B9B5-F8CDE8E22750}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Foorum/Foorum.csproj b/Foorum/Foorum.csproj
index a1ef45f..600e2f6 100644
--- a/Foorum/Foorum.csproj
+++ b/Foorum/Foorum.csproj
@@ -1,6 +1,6 @@
-
-
+
+
Debug
@@ -43,8 +43,14 @@
4
-
- ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
+
+
+ ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.5\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
@@ -108,8 +114,8 @@
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Foorum/packages.config b/Foorum/packages.config
index 1c612a2..d15da3c 100644
--- a/Foorum/packages.config
+++ b/Foorum/packages.config
@@ -1,5 +1,6 @@
-
-
+
+
+
\ No newline at end of file