diff --git a/VolunterSite.WebUI/Cozy.Service/Class1.cs b/VolunterSite.WebUI/Cozy.Service/Class1.cs
new file mode 100644
index 0000000..e2f4757
--- /dev/null
+++ b/VolunterSite.WebUI/Cozy.Service/Class1.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace Cozy.Service
+{
+ public class Class1
+ {
+ }
+}
diff --git a/VolunterSite.WebUI/Cozy.Service/Cozy.Service.csproj b/VolunterSite.WebUI/Cozy.Service/Cozy.Service.csproj
new file mode 100644
index 0000000..c16c6d5
--- /dev/null
+++ b/VolunterSite.WebUI/Cozy.Service/Cozy.Service.csproj
@@ -0,0 +1,7 @@
+
+
+
+ netcoreapp2.2
+
+
+
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Context/VolunteerSiteDbContext.cs b/VolunterSite.WebUI/VolunteerSite.Data/Context/VolunteerSiteDbContext.cs
new file mode 100644
index 0000000..fa1ded0
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Context/VolunteerSiteDbContext.cs
@@ -0,0 +1,64 @@
+using Microsoft.EntityFrameworkCore;
+using VolunteerSite.Domain.Models;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
+using Microsoft.AspNetCore.Identity;
+
+namespace VolunteerSite.Data.Context
+{
+ public class VolunteerSiteDbContext : IdentityDbContext
+ {
+ //public DbSet Volunteers { get; set; }
+
+
+ public DbSet VolunteerGroups { get; set; }
+ public DbSet Organizations { get; set; }
+ public DbSet JobListings { get; set; }
+ public DbSet GroupMembers { get; set; }
+ public DbSet Volunteers { get; set; }
+
+ // Setting up the provider (SQL Server) and location of the Database
+ protected override void OnConfiguring(DbContextOptionsBuilder optionBuilder)
+ {
+ // bad way of providing the connection string
+ optionBuilder.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=volunteersite;Trusted_Connection=True");
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ modelBuilder.Entity()
+ .HasOne(u => u.Volunteer)
+ .WithOne(v => v.User)
+ .HasForeignKey(v => v.UserId);
+
+ modelBuilder.Entity()
+ .HasOne(g => g.GroupAdmin)
+ .WithMany(u => u.VolunteerGroups)
+ .HasForeignKey(g => g.GroupAdminId)
+ .HasConstraintName("ForeignKey_VolunteerGroup_AppUser");
+
+ modelBuilder.Entity()
+ .HasOne(u => u.Organization)
+ .WithOne(o => o.OrganizationAdmin)
+ .HasForeignKey(o => o.OrganizationAdminId)
+ .HasConstraintName("ForeignKey_Organization_AppUser");
+
+ modelBuilder.Entity()
+ .HasOne(j => j.Volunteer)
+ .WithMany(u => u.SavedJobListings)
+ .HasForeignKey(j => j.VolunteerId)
+ .HasConstraintName("ForeignKey_SavedJobListing_Volunteer");
+
+
+ modelBuilder.Entity().HasData(
+ new IdentityRole { Name = "Volunteer", NormalizedName = "VOLUNTEER" },
+ new IdentityRole { Name = "OrganizationAdmin", NormalizedName = "ORGANIZATIONADMIN" },
+ new IdentityRole { Name = "GroupAdmin", NormalizedName = "GROUPADMIN" }
+ );
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreGroupMemberRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreGroupMemberRepository.cs
new file mode 100644
index 0000000..2f584d6
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreGroupMemberRepository.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Context;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.EFCore
+{
+ public class EFCoreGroupMemberRepository : IGroupMemberRepository
+ {
+ public GroupMember Create(GroupMember newGroupMember)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ context.GroupMembers.Add(newGroupMember);
+ context.SaveChanges();
+
+ return newGroupMember;
+ }
+ }
+
+ public bool DeleteById(int groupMemberId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var groupMemberToBeDeleted = GetById(groupMemberId);
+ context.Remove(groupMemberToBeDeleted);
+ context.SaveChanges();
+
+ if (GetById(groupMemberId) == null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public ICollection GetByGroupId(string volunteerGroupId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.GroupMembers.Where(m => m.VolunteerGroupId == volunteerGroupId).ToList();
+ }
+ }
+
+ public GroupMember GetById(int groupMemberId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.GroupMembers.Single(m => m.Id == groupMemberId);
+ }
+ }
+
+ public GroupMember Update(GroupMember updatedGroupMember)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var existingGroupMember = GetById(updatedGroupMember.Id);
+ context.Entry(existingGroupMember).CurrentValues.SetValues(updatedGroupMember);
+ context.SaveChanges();
+
+ return existingGroupMember;
+ }
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreJobListingRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreJobListingRepository.cs
new file mode 100644
index 0000000..dda3b1a
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreJobListingRepository.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Context;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.EFCore
+{
+ public class EFCoreJobListingRepository : IJobListingRepository
+ {
+ public JobListing Create(JobListing newJobListing)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ context.JobListings.Add(newJobListing);
+ context.SaveChanges();
+
+ return newJobListing;
+ }
+ }
+
+ public bool DeleteById(int jobListingId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var jobListingToBeDeleted = GetById(jobListingId);
+ context.Remove(jobListingToBeDeleted);
+ context.SaveChanges();
+
+ if (GetById(jobListingId) == null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+
+ public JobListing GetById(int jobListingId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.JobListings.Single(j => j.Id == jobListingId);
+ }
+ }
+
+ public ICollection GetAll()
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.JobListings.AsEnumerable().ToList();
+ }
+ }
+
+ public ICollection GetByOrganizationId(int organizationId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.JobListings.Where(j => j.OrganizationId == organizationId).ToList();
+ }
+ }
+
+ public ICollection GetByTypeOfJob(string typeOfJob)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.JobListings.Where(m => m.TypeOfJob == typeOfJob).ToList();
+ }
+ }
+
+ public JobListing Update(JobListing updatedJobListing)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var existingJobListing = GetById(updatedJobListing.Id);
+ context.Entry(existingJobListing).CurrentValues.SetValues(updatedJobListing);
+ context.SaveChanges();
+
+ return existingJobListing;
+ }
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreOrganizationRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreOrganizationRepository.cs
new file mode 100644
index 0000000..1c69f1b
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreOrganizationRepository.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Context;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.EFCore
+{
+ public class EFCoreOrganizationRepository : IOrganizationRepository
+ {
+ public Organization Create(Organization newOrganization)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ context.Organizations.Add(newOrganization);
+ context.SaveChanges();
+
+ return newOrganization;
+ }
+ }
+
+ public bool DeleteById(int organizationId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var organizationToBeDeleted = GetById(organizationId);
+ context.Remove(organizationToBeDeleted);
+ context.SaveChanges();
+
+ if (GetById(organizationId) == null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public Organization GetById(int organizationId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.Organizations.Single(o => o.Id == organizationId);
+ }
+ }
+
+ public Organization GetByAdminId(string adminId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.Organizations.Single(o => o.OrganizationAdminId == adminId);
+ }
+ }
+
+ public Organization Update(Organization updatedOrganization)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var existingOrganization = GetById(updatedOrganization.Id);
+ context.Entry(existingOrganization).CurrentValues.SetValues(updatedOrganization);
+ context.SaveChanges();
+
+ return existingOrganization;
+ }
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerGroupRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerGroupRepository.cs
new file mode 100644
index 0000000..36686f2
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerGroupRepository.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Context;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.EFCore
+{
+ public class EFCoreVolunteerGroupRepository : IVolunteerGroupRepository
+ {
+ public VolunteerGroup Create(VolunteerGroup newVolunteerGroup)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ context.VolunteerGroups.Add(newVolunteerGroup);
+ context.SaveChanges();
+
+ return newVolunteerGroup;
+ }
+ }
+
+ public bool DeleteById(int volunteerGroupId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var volunteerGroupToBeDeleted = GetById(volunteerGroupId);
+ context.Remove(volunteerGroupToBeDeleted);
+ context.SaveChanges();
+
+ if (GetById(volunteerGroupId) == null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public VolunteerGroup GetById(int volunteerGroupId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.VolunteerGroups.Single(v => v.Id == volunteerGroupId);
+ }
+ }
+
+ public VolunteerGroup Update(VolunteerGroup updatedVolunteerGroup)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var existingVolunteerGroup = GetById(updatedVolunteerGroup.Id);
+ context.Entry(existingVolunteerGroup).CurrentValues.SetValues(updatedVolunteerGroup);
+ context.SaveChanges();
+
+ return existingVolunteerGroup;
+ }
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerRepository.cs
new file mode 100644
index 0000000..57908ed
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerRepository.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VolunteerSite.Domain.Models;
+using VolunteerSite.Data.Context;
+using VolunteerSite.Data.Interfaces;
+using System.Linq;
+
+namespace VolunteerSite.Data.Implementation.EFCore
+{
+ public class EFCoreVolunteerRepository : IVolunteerRepository
+ {
+ public Volunteer Create(Volunteer newVolunteer)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ context.Volunteers.Add(newVolunteer);
+ context.SaveChanges();
+
+ return newVolunteer;
+ }
+ }
+ public bool DeleteById(int volunteerId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var volunteerToBeDeleted = GetById(volunteerId);
+ context.Remove(volunteerToBeDeleted);
+ context.SaveChanges();
+
+ if (GetById(volunteerId) == null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public Volunteer GetById(int volunteerId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.Volunteers.Single(v => v.Id == volunteerId);
+ }
+ }
+
+ public Volunteer GetByUserId(string UserId)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ return context.Volunteers.Single(v => v.UserId == UserId);
+ }
+ }
+
+ public Volunteer Update(Volunteer updatedVolunteer)
+ {
+ using (var context = new VolunteerSiteDbContext())
+ {
+ var existingVolunteer = GetById(updatedVolunteer.Id);
+ context.Entry(existingVolunteer).CurrentValues.SetValues(updatedVolunteer);
+ context.SaveChanges();
+
+ return existingVolunteer;
+ }
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockGroupMemberRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockGroupMemberRepository.cs
new file mode 100644
index 0000000..a88335c
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockGroupMemberRepository.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.Mock
+{
+ public class MockGroupMemberRepository : IGroupMemberRepository
+ {
+ private List GroupMembers = new List()
+ {
+
+ };
+
+ public GroupMember GetById(int groupMemberId)
+ {
+ return GroupMembers.Single(g => g.Id == groupMemberId);
+ }
+
+ public GroupMember Create(GroupMember newHome)
+ {
+ newHome.Id = GroupMembers.OrderByDescending(g => g.Id).Single().Id + 1;
+ GroupMembers.Add(newHome);
+
+ return newHome;
+ }
+
+ public GroupMember Update(GroupMember updatedGroupMember)
+ {
+ DeleteById(updatedGroupMember.Id); // delete the existing home
+ GroupMembers.Add(updatedGroupMember);
+
+ return updatedGroupMember;
+ }
+
+ public bool DeleteById(int groupMemberId)
+ {
+ var GroupMember = GetById(groupMemberId);
+ GroupMembers.Remove(GroupMember);
+ return true;
+ }
+
+ public ICollection GetByGroupId(string volunteerGroupId)
+ {
+ return GroupMembers.FindAll(m => m.VolunteerGroupId == volunteerGroupId);
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockJobListingRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockJobListingRepository.cs
new file mode 100644
index 0000000..3a401de
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockJobListingRepository.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.Mock
+{
+ class MockJobListingRepository : IJobListingRepository
+ {
+ private readonly List JobListings = new List()
+ {
+
+ };
+
+ public JobListing GetById(int jobListingId)
+ {
+ return JobListings.Single(j => j.Id == jobListingId);
+ }
+
+ public ICollection GetByOrganizationId(int organizationId)
+ {
+ return JobListings.FindAll(j => j.OrganizationId == organizationId);
+ }
+
+ public ICollection GetByTypeOfJob(string typeOfJob)
+ {
+ return JobListings.FindAll(j => j.TypeOfJob == typeOfJob);
+ }
+
+ public JobListing Create(JobListing newJobListing)
+ {
+ newJobListing.Id = JobListings.OrderByDescending(j => j.Id).Single().Id + 1;
+ JobListings.Add(newJobListing);
+
+ return newJobListing;
+ }
+
+ public JobListing Update(JobListing updatedJobListing)
+ {
+ DeleteById(updatedJobListing.Id); // delete the existing home
+ JobListings.Add(updatedJobListing);
+
+ return updatedJobListing;
+ }
+
+ public bool DeleteById(int jobListingId)
+ {
+ var JobListing = GetById(jobListingId);
+ JobListings.Remove(JobListing);
+ return true;
+ }
+
+ public ICollection GetAll()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockOrganizationRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockOrganizationRepository.cs
new file mode 100644
index 0000000..74231df
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockOrganizationRepository.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.Mock
+{
+ class MockOrganizationRepository : IOrganizationRepository
+ {
+ private List Organizations = new List()
+ {
+
+ };
+
+ public Organization Create(Organization newOrganization)
+ {
+ newOrganization.Id = Organizations.OrderByDescending(h => h.Id).Single().Id + 1;
+ Organizations.Add(newOrganization);
+
+ return newOrganization;
+ }
+
+ public bool DeleteById(int organizationId)
+ {
+ var organization = GetById(organizationId);
+ Organizations.Remove(organization);
+ return true;
+ }
+
+ public Organization GetById(int organizationId)
+ {
+ return Organizations.Single(h => h.Id == organizationId);
+ }
+
+ public Organization GetByAdminId(string adminId)
+ {
+ return Organizations.Single(o => o.OrganizationAdminId == adminId);
+ }
+
+ public Organization Update(Organization updatedOrganization)
+ {
+ DeleteById(updatedOrganization.Id);
+ Organizations.Add(updatedOrganization);
+
+ return updatedOrganization;
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerGroupRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerGroupRepository.cs
new file mode 100644
index 0000000..1e7b624
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerGroupRepository.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.Mock
+{
+ public class MockVolunteerGroupRepository : IVolunteerGroupRepository
+ {
+ private List VolunteerGroups = new List()
+ {
+
+ };
+
+ public VolunteerGroup Create(VolunteerGroup newVolunteerGroup)
+ {
+ newVolunteerGroup.Id = VolunteerGroups.OrderByDescending(v => v.Id).Single().Id + 1;
+ VolunteerGroups.Add(newVolunteerGroup);
+
+ return newVolunteerGroup;
+ }
+
+ public bool DeleteById(int volunteerGroupId)
+ {
+ var home = GetById(volunteerGroupId);
+ VolunteerGroups.Remove(home);
+ return true;
+ }
+
+ public VolunteerGroup GetById(int volunteerGroupId)
+ {
+ return VolunteerGroups.Single(v => v.Id == volunteerGroupId);
+ }
+
+ public VolunteerGroup Update(VolunteerGroup updatedVolunteerGroup)
+ {
+ DeleteById(updatedVolunteerGroup.Id);
+ VolunteerGroups.Add(updatedVolunteerGroup);
+
+ return updatedVolunteerGroup;
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerRepository.cs
new file mode 100644
index 0000000..412df79
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerRepository.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using VolunteerSite.Data.Interfaces;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Implementation.Mock
+{
+ class MockVolunteerRepository : IVolunteerRepository
+ {
+ private List Volunteers = new List()
+ {
+
+ };
+
+ public Volunteer Create(Volunteer newVolunteer)
+ {
+ newVolunteer.Id = Volunteers.OrderByDescending(h => h.Id).Single().Id + 1;
+ Volunteers.Add(newVolunteer);
+
+ return newVolunteer;
+ }
+
+ public bool DeleteById(int volunteerId)
+ {
+ var home = GetById(volunteerId);
+ Volunteers.Remove(home);
+ return true;
+ }
+
+ public Volunteer GetById(int volunteerId)
+ {
+ return Volunteers.Single(h => h.Id == volunteerId);
+ }
+
+ public Volunteer GetByUserId(string userId)
+ {
+ return Volunteers.Single(h => h.UserId == userId);
+ }
+
+ public Volunteer Update(Volunteer updatedVolunteer)
+ {
+ DeleteById(updatedVolunteer.Id);
+ Volunteers.Add(updatedVolunteer);
+
+ return updatedVolunteer;
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IGroupMemberRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IGroupMemberRepository.cs
new file mode 100644
index 0000000..a5b239e
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IGroupMemberRepository.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Interfaces
+{
+ public interface IGroupMemberRepository
+ {
+ //read
+ GroupMember GetById(int groupMemberId);
+ ICollection GetByGroupId(string volunteerGroupId);
+
+ //create
+ GroupMember Create(GroupMember newGroupMember);
+
+ //Update
+ GroupMember Update(GroupMember UpdatedGroupMember);
+
+ //Delete
+ bool DeleteById(int groupMemberId);
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IJobListingRepository - Copy.cs b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IJobListingRepository - Copy.cs
new file mode 100644
index 0000000..f49a463
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IJobListingRepository - Copy.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Interfaces
+{
+ public interface IJobListingRepository
+ {
+ //Read
+ JobListing GetById(int jobListingId);
+ ICollection GetByOrganizationId(int organizationId);
+ ICollection GetByTypeOfJob(string typeOfJob);
+
+ ICollection GetAll();
+
+ // Create
+ JobListing Create(JobListing newJobListing);
+
+ //Update
+ JobListing Update(JobListing updatedJobListing);
+
+ //Delete
+ bool DeleteById(int jobListingId);
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IOrganizationRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IOrganizationRepository.cs
new file mode 100644
index 0000000..e873c86
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IOrganizationRepository.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Interfaces
+{
+ public interface IOrganizationRepository
+ {
+ //Read
+ Organization GetById(int organizationId);
+
+ Organization GetByAdminId(string adminId);
+
+ // Create
+ Organization Create(Organization newOrganization);
+
+ //Update
+ Organization Update(Organization updatedOrganization);
+
+ //Delete
+ bool DeleteById(int organizationId);
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerGroupRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerGroupRepository.cs
new file mode 100644
index 0000000..c8204a4
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerGroupRepository.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Interfaces
+{
+ public interface IVolunteerGroupRepository
+ {
+ //Read
+ VolunteerGroup GetById(int volunteerGroupId);
+
+ // Create
+ VolunteerGroup Create(VolunteerGroup newVolunteerGroup);
+
+ //Update
+ VolunteerGroup Update(VolunteerGroup updatedVolunteerGroup);
+
+ //Delete
+ bool DeleteById(int volunteerGroupId);
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerRepository.cs
new file mode 100644
index 0000000..7d8532c
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerRepository.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VolunteerSite.Domain.Models;
+
+namespace VolunteerSite.Data.Interfaces
+{
+ public interface IVolunteerRepository
+ {
+ //Read
+ Volunteer GetById(int volunteerId);
+
+ Volunteer GetByUserId(string UserId);
+ // Create
+ Volunteer Create(Volunteer newVolunteer);
+
+ //Update
+ Volunteer Update(Volunteer updatedVolunteer);
+
+ //Delete
+ bool DeleteById(int volunteerId);
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190204080041_initial.Designer.cs b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190204080041_initial.Designer.cs
new file mode 100644
index 0000000..d5218b7
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190204080041_initial.Designer.cs
@@ -0,0 +1,168 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using VolunteerSite.Data.Context;
+
+namespace VolunteerSite.Data.Migrations
+{
+ [DbContext(typeof(VolunteerSiteDbContext))]
+ [Migration("20190204080041_initial")]
+ partial class initial
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.1-servicing-10028")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.GroupMember", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Email");
+
+ b.Property("FirstName");
+
+ b.Property("LastName");
+
+ b.Property("PhoneNumber");
+
+ b.Property("TotalHours");
+
+ b.Property("VolunteerGroupId");
+
+ b.Property("VolunteerGroupId1");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolunteerGroupId1");
+
+ b.ToTable("GroupMembers");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.JobListing", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Address");
+
+ b.Property("City");
+
+ b.Property("Date");
+
+ b.Property("Description");
+
+ b.Property("OrganizationId");
+
+ b.Property("OrganizationId1");
+
+ b.Property("PositionsAvailable");
+
+ b.Property("State");
+
+ b.Property("TypeOfJob");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrganizationId1");
+
+ b.ToTable("JobListings");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.Organization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Address");
+
+ b.Property("City");
+
+ b.Property("CompanyName");
+
+ b.Property("Email");
+
+ b.Property("PhoneNumber");
+
+ b.Property("State");
+
+ b.HasKey("Id");
+
+ b.ToTable("Organizations");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.Volunteer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Email");
+
+ b.Property("FirstName");
+
+ b.Property("LastName");
+
+ b.Property("PhoneNumber");
+
+ b.Property("SkillsAndExperience");
+
+ b.HasKey("Id");
+
+ b.ToTable("Volunteers");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.VolunteerGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("GroupName");
+
+ b.Property("GroupOwnerId");
+
+ b.Property("GroupOwnerId1");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GroupOwnerId1");
+
+ b.ToTable("VolunteerGroups");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.GroupMember", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.VolunteerGroup", "VolunteerGroup")
+ .WithMany("GroupMembers")
+ .HasForeignKey("VolunteerGroupId1");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.JobListing", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.Organization", "Organization")
+ .WithMany("JobListings")
+ .HasForeignKey("OrganizationId1");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.VolunteerGroup", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.Volunteer", "GroupOwner")
+ .WithMany("VolunteerGroups")
+ .HasForeignKey("GroupOwnerId1");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190204080041_initial.cs b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190204080041_initial.cs
new file mode 100644
index 0000000..3bee4d1
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190204080041_initial.cs
@@ -0,0 +1,153 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace VolunteerSite.Data.Migrations
+{
+ public partial class initial : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Organizations",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ CompanyName = table.Column(nullable: true),
+ Address = table.Column(nullable: true),
+ City = table.Column(nullable: true),
+ State = table.Column(nullable: true),
+ Email = table.Column(nullable: true),
+ PhoneNumber = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Organizations", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Volunteers",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ FirstName = table.Column(nullable: true),
+ LastName = table.Column(nullable: true),
+ Email = table.Column(nullable: true),
+ PhoneNumber = table.Column(nullable: true),
+ SkillsAndExperience = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Volunteers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "JobListings",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ Address = table.Column(nullable: true),
+ City = table.Column(nullable: true),
+ State = table.Column(nullable: true),
+ PositionsAvailable = table.Column(nullable: false),
+ Description = table.Column(nullable: true),
+ TypeOfJob = table.Column(nullable: true),
+ Date = table.Column(nullable: false),
+ OrganizationId = table.Column(nullable: true),
+ OrganizationId1 = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_JobListings", x => x.Id);
+ table.ForeignKey(
+ name: "FK_JobListings_Organizations_OrganizationId1",
+ column: x => x.OrganizationId1,
+ principalTable: "Organizations",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "VolunteerGroups",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ GroupName = table.Column(nullable: true),
+ GroupOwnerId = table.Column(nullable: true),
+ GroupOwnerId1 = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VolunteerGroups", x => x.Id);
+ table.ForeignKey(
+ name: "FK_VolunteerGroups_Volunteers_GroupOwnerId1",
+ column: x => x.GroupOwnerId1,
+ principalTable: "Volunteers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "GroupMembers",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ FirstName = table.Column(nullable: true),
+ LastName = table.Column(nullable: true),
+ Email = table.Column(nullable: true),
+ PhoneNumber = table.Column(nullable: true),
+ TotalHours = table.Column(nullable: false),
+ VolunteerGroupId = table.Column(nullable: true),
+ VolunteerGroupId1 = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_GroupMembers", x => x.Id);
+ table.ForeignKey(
+ name: "FK_GroupMembers_VolunteerGroups_VolunteerGroupId1",
+ column: x => x.VolunteerGroupId1,
+ principalTable: "VolunteerGroups",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_GroupMembers_VolunteerGroupId1",
+ table: "GroupMembers",
+ column: "VolunteerGroupId1");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_JobListings_OrganizationId1",
+ table: "JobListings",
+ column: "OrganizationId1");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_VolunteerGroups_GroupOwnerId1",
+ table: "VolunteerGroups",
+ column: "GroupOwnerId1");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "GroupMembers");
+
+ migrationBuilder.DropTable(
+ name: "JobListings");
+
+ migrationBuilder.DropTable(
+ name: "VolunteerGroups");
+
+ migrationBuilder.DropTable(
+ name: "Organizations");
+
+ migrationBuilder.DropTable(
+ name: "Volunteers");
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410044449_identity-provider.Designer.cs b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410044449_identity-provider.Designer.cs
new file mode 100644
index 0000000..047adc0
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410044449_identity-provider.Designer.cs
@@ -0,0 +1,399 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using VolunteerSite.Data.Context;
+
+namespace VolunteerSite.Data.Migrations
+{
+ [DbContext(typeof(VolunteerSiteDbContext))]
+ [Migration("20190410044449_identity-provider")]
+ partial class identityprovider
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken();
+
+ b.Property("Name")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256);
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasName("RoleNameIndex")
+ .HasFilter("[NormalizedName] IS NOT NULL");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType");
+
+ b.Property("ClaimValue");
+
+ b.Property("RoleId")
+ .IsRequired();
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType");
+
+ b.Property("ClaimValue");
+
+ b.Property("UserId")
+ .IsRequired();
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider");
+
+ b.Property("ProviderKey");
+
+ b.Property("ProviderDisplayName");
+
+ b.Property("UserId")
+ .IsRequired();
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId");
+
+ b.Property("RoleId");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId");
+
+ b.Property("LoginProvider");
+
+ b.Property("Name");
+
+ b.Property("Value");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.AppUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AccessFailedCount");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken();
+
+ b.Property("Email")
+ .HasMaxLength(256);
+
+ b.Property("EmailConfirmed");
+
+ b.Property("FirstName");
+
+ b.Property("LastName");
+
+ b.Property("LockoutEnabled");
+
+ b.Property("LockoutEnd");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256);
+
+ b.Property("PasswordHash");
+
+ b.Property("PhoneNumber");
+
+ b.Property("PhoneNumberConfirmed");
+
+ b.Property("SecurityStamp");
+
+ b.Property("SkillsAndExperience");
+
+ b.Property("TwoFactorEnabled");
+
+ b.Property("UserName")
+ .HasMaxLength(256);
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasName("UserNameIndex")
+ .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.GroupMember", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Email");
+
+ b.Property("FirstName");
+
+ b.Property("LastName");
+
+ b.Property("PhoneNumber");
+
+ b.Property("TotalHours");
+
+ b.Property("VolunteerGroupId");
+
+ b.Property("VolunteerGroupId1");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolunteerGroupId1");
+
+ b.ToTable("GroupMembers");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.JobListing", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Address");
+
+ b.Property("City");
+
+ b.Property("Date");
+
+ b.Property("Description");
+
+ b.Property("OrganizationId");
+
+ b.Property("OrganizationId1");
+
+ b.Property("PositionsAvailable");
+
+ b.Property("State");
+
+ b.Property("TypeOfJob");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrganizationId1");
+
+ b.ToTable("JobListings");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.Organization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Address");
+
+ b.Property("AppUserId");
+
+ b.Property("City");
+
+ b.Property("CompanyName");
+
+ b.Property("Email");
+
+ b.Property("PhoneNumber");
+
+ b.Property("State");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Organizations");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.Volunteer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("Email");
+
+ b.Property("FirstName");
+
+ b.Property("LastName");
+
+ b.Property("PhoneNumber");
+
+ b.Property("SkillsAndExperience");
+
+ b.HasKey("Id");
+
+ b.ToTable("Volunteer");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.VolunteerGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("AppUserId");
+
+ b.Property("GroupName");
+
+ b.Property("GroupOwnerId");
+
+ b.Property("GroupOwnerId1");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("GroupOwnerId1");
+
+ b.ToTable("VolunteerGroups");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.AppUser")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.AppUser")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("VolunteerSite.Domain.Models.AppUser")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.AppUser")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.GroupMember", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.VolunteerGroup", "VolunteerGroup")
+ .WithMany("GroupMembers")
+ .HasForeignKey("VolunteerGroupId1");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.JobListing", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.Organization", "Organization")
+ .WithMany("JobListings")
+ .HasForeignKey("OrganizationId1");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.Organization", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.AppUser")
+ .WithMany("Organizations")
+ .HasForeignKey("AppUserId");
+ });
+
+ modelBuilder.Entity("VolunteerSite.Domain.Models.VolunteerGroup", b =>
+ {
+ b.HasOne("VolunteerSite.Domain.Models.AppUser")
+ .WithMany("VolunteerGroups")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("VolunteerSite.Domain.Models.Volunteer", "GroupOwner")
+ .WithMany("VolunteerGroups")
+ .HasForeignKey("GroupOwnerId1");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410044449_identity-provider.cs b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410044449_identity-provider.cs
new file mode 100644
index 0000000..6caccc8
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410044449_identity-provider.cs
@@ -0,0 +1,333 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace VolunteerSite.Data.Migrations
+{
+ public partial class identityprovider : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_VolunteerGroups_Volunteers_GroupOwnerId1",
+ table: "VolunteerGroups");
+
+ migrationBuilder.DropPrimaryKey(
+ name: "PK_Volunteers",
+ table: "Volunteers");
+
+ migrationBuilder.RenameTable(
+ name: "Volunteers",
+ newName: "Volunteer");
+
+ migrationBuilder.AddColumn(
+ name: "AppUserId",
+ table: "VolunteerGroups",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "AppUserId",
+ table: "Organizations",
+ nullable: true);
+
+ migrationBuilder.AddPrimaryKey(
+ name: "PK_Volunteer",
+ table: "Volunteer",
+ column: "Id");
+
+ migrationBuilder.CreateTable(
+ name: "AspNetRoles",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false),
+ Name = table.Column(maxLength: 256, nullable: true),
+ NormalizedName = table.Column(maxLength: 256, nullable: true),
+ ConcurrencyStamp = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoles", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUsers",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false),
+ UserName = table.Column(maxLength: 256, nullable: true),
+ NormalizedUserName = table.Column(maxLength: 256, nullable: true),
+ Email = table.Column(maxLength: 256, nullable: true),
+ NormalizedEmail = table.Column(maxLength: 256, nullable: true),
+ EmailConfirmed = table.Column(nullable: false),
+ PasswordHash = table.Column(nullable: true),
+ SecurityStamp = table.Column(nullable: true),
+ ConcurrencyStamp = table.Column(nullable: true),
+ PhoneNumber = table.Column(nullable: true),
+ PhoneNumberConfirmed = table.Column(nullable: false),
+ TwoFactorEnabled = table.Column(nullable: false),
+ LockoutEnd = table.Column(nullable: true),
+ LockoutEnabled = table.Column(nullable: false),
+ AccessFailedCount = table.Column(nullable: false),
+ FirstName = table.Column(nullable: true),
+ LastName = table.Column(nullable: true),
+ SkillsAndExperience = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUsers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetRoleClaims",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ RoleId = table.Column(nullable: false),
+ ClaimType = table.Column(nullable: true),
+ ClaimValue = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserClaims",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ UserId = table.Column(nullable: false),
+ ClaimType = table.Column(nullable: true),
+ ClaimValue = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetUserClaims_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserLogins",
+ columns: table => new
+ {
+ LoginProvider = table.Column(nullable: false),
+ ProviderKey = table.Column(nullable: false),
+ ProviderDisplayName = table.Column(nullable: true),
+ UserId = table.Column(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
+ table.ForeignKey(
+ name: "FK_AspNetUserLogins_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserRoles",
+ columns: table => new
+ {
+ UserId = table.Column(nullable: false),
+ RoleId = table.Column(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserTokens",
+ columns: table => new
+ {
+ UserId = table.Column(nullable: false),
+ LoginProvider = table.Column(nullable: false),
+ Name = table.Column(nullable: false),
+ Value = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
+ table.ForeignKey(
+ name: "FK_AspNetUserTokens_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_VolunteerGroups_AppUserId",
+ table: "VolunteerGroups",
+ column: "AppUserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Organizations_AppUserId",
+ table: "Organizations",
+ column: "AppUserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetRoleClaims_RoleId",
+ table: "AspNetRoleClaims",
+ column: "RoleId");
+
+ migrationBuilder.CreateIndex(
+ name: "RoleNameIndex",
+ table: "AspNetRoles",
+ column: "NormalizedName",
+ unique: true,
+ filter: "[NormalizedName] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserClaims_UserId",
+ table: "AspNetUserClaims",
+ column: "UserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserLogins_UserId",
+ table: "AspNetUserLogins",
+ column: "UserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserRoles_RoleId",
+ table: "AspNetUserRoles",
+ column: "RoleId");
+
+ migrationBuilder.CreateIndex(
+ name: "EmailIndex",
+ table: "AspNetUsers",
+ column: "NormalizedEmail");
+
+ migrationBuilder.CreateIndex(
+ name: "UserNameIndex",
+ table: "AspNetUsers",
+ column: "NormalizedUserName",
+ unique: true,
+ filter: "[NormalizedUserName] IS NOT NULL");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Organizations_AspNetUsers_AppUserId",
+ table: "Organizations",
+ column: "AppUserId",
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VolunteerGroups_AspNetUsers_AppUserId",
+ table: "VolunteerGroups",
+ column: "AppUserId",
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VolunteerGroups_Volunteer_GroupOwnerId1",
+ table: "VolunteerGroups",
+ column: "GroupOwnerId1",
+ principalTable: "Volunteer",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Organizations_AspNetUsers_AppUserId",
+ table: "Organizations");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_VolunteerGroups_AspNetUsers_AppUserId",
+ table: "VolunteerGroups");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_VolunteerGroups_Volunteer_GroupOwnerId1",
+ table: "VolunteerGroups");
+
+ migrationBuilder.DropTable(
+ name: "AspNetRoleClaims");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserClaims");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserLogins");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserRoles");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserTokens");
+
+ migrationBuilder.DropTable(
+ name: "AspNetRoles");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUsers");
+
+ migrationBuilder.DropIndex(
+ name: "IX_VolunteerGroups_AppUserId",
+ table: "VolunteerGroups");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Organizations_AppUserId",
+ table: "Organizations");
+
+ migrationBuilder.DropPrimaryKey(
+ name: "PK_Volunteer",
+ table: "Volunteer");
+
+ migrationBuilder.DropColumn(
+ name: "AppUserId",
+ table: "VolunteerGroups");
+
+ migrationBuilder.DropColumn(
+ name: "AppUserId",
+ table: "Organizations");
+
+ migrationBuilder.RenameTable(
+ name: "Volunteer",
+ newName: "Volunteers");
+
+ migrationBuilder.AddPrimaryKey(
+ name: "PK_Volunteers",
+ table: "Volunteers",
+ column: "Id");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VolunteerGroups_Volunteers_GroupOwnerId1",
+ table: "VolunteerGroups",
+ column: "GroupOwnerId1",
+ principalTable: "Volunteers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ }
+ }
+}
diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410054223_identity-provider2.Designer.cs b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410054223_identity-provider2.Designer.cs
new file mode 100644
index 0000000..7dde391
--- /dev/null
+++ b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/20190410054223_identity-provider2.Designer.cs
@@ -0,0 +1,370 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using VolunteerSite.Data.Context;
+
+namespace VolunteerSite.Data.Migrations
+{
+ [DbContext(typeof(VolunteerSiteDbContext))]
+ [Migration("20190410054223_identity-provider2")]
+ partial class identityprovider2
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken();
+
+ b.Property("Name")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256);
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasName("RoleNameIndex")
+ .HasFilter("[NormalizedName] IS NOT NULL");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType");
+
+ b.Property("ClaimValue");
+
+ b.Property("RoleId")
+ .IsRequired();
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType");
+
+ b.Property("ClaimValue");
+
+ b.Property("UserId")
+ .IsRequired();
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider");
+
+ b.Property("ProviderKey");
+
+ b.Property("ProviderDisplayName");
+
+ b.Property("UserId")
+ .IsRequired();
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole