diff --git a/VolunterSite.WebUI/VolunteerSite.Data/Context/VolunteerSiteDbContext.cs b/VolunterSite.WebUI/VolunteerSite.Data/Context/VolunteerSiteDbContext.cs new file mode 100644 index 0000000..d213562 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Context/VolunteerSiteDbContext.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using VolunteerSite.Domain.Models; +using System; +using System.Collections.Generic; +using System.Text; + +namespace VolunteerSite.Data.Context +{ + public class VolunteerSiteDbContext : DbContext + { + 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; } + + // 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"); + } + } +} 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..a46ae92 --- /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 +{ + 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..ddacb98 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreJobListingRepository.cs @@ -0,0 +1,77 @@ +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 +{ + 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 GetByOrganizationId(string 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..ba42ce0 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreOrganizationRepository.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 +{ + 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 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/EFCoreVolunteer.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteer.cs new file mode 100644 index 0000000..fdc09b6 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteer.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 +{ + class EFCoreVolunteer : 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 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/EFCore/EFCoreVolunteerGroup.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerGroup.cs new file mode 100644 index 0000000..1507b0e --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/EFCore/EFCoreVolunteerGroup.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 +{ + class EFCoreVolunteerGroup : 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/Mock/MockGroupMemberRepository.cs b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockGroupMemberRepository.cs new file mode 100644 index 0000000..c35f9c5 --- /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 +{ + 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(int groupId) + { + throw new NotImplementedException(); + } + } +} 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..6aef28a --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockJobListingRepository.cs @@ -0,0 +1,55 @@ +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 List JobListings = new List() + { + + }; + + public JobListing GetById(int jobListingId) + { + return JobListings.Single(j => j.Id == jobListingId); + } + + public ICollection GetByOrganizationId(string 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; + } + } +} 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..7f1740c --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockOrganizationRepository.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 +{ + 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 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..1e893cf --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Implementation/Mock/MockVolunteerRepository.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 +{ + 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 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..07c931a --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IJobListingRepository - Copy.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; +using VolunteerSite.Domain.Models; + +namespace VolunteerSite.Data.Interfaces +{ + interface IJobListingRepository + { + //Read + JobListing GetById(int jobListingId); + ICollection GetByOrganizationId(string organizationId); + ICollection GetByTypeOfJob(string typeOfJob); + + // 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..7c9f91a --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IOrganizationRepository.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +using VolunteerSite.Domain.Models; + +namespace VolunteerSite.Data.Interfaces +{ + interface IOrganizationRepository + { + //Read + Organization GetById(int organizationId); + + // 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..7b4484d --- /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 +{ + 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..f9f759f --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Interfaces/IVolunteerRepository.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +using VolunteerSite.Domain.Models; + +namespace VolunteerSite.Data.Interfaces +{ + interface IVolunteerRepository + { + //Read + Volunteer GetById(int volunteerId); + + // 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/VolunteerSiteDbContextModelSnapshot.cs b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/VolunteerSiteDbContextModelSnapshot.cs new file mode 100644 index 0000000..504fb09 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/Migrations/VolunteerSiteDbContextModelSnapshot.cs @@ -0,0 +1,166 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VolunteerSite.Data.Context; + +namespace VolunteerSite.Data.Migrations +{ + [DbContext(typeof(VolunteerSiteDbContext))] + partial class VolunteerSiteDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(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/VolunteerSite.Data.csproj b/VolunterSite.WebUI/VolunteerSite.Data/VolunteerSite.Data.csproj new file mode 100644 index 0000000..48e0d90 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Data/VolunteerSite.Data.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.2 + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/Models/ErrorViewModel.cs b/VolunterSite.WebUI/VolunteerSite.Domain/Models/ErrorViewModel.cs new file mode 100644 index 0000000..8167476 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace VolunterSite.WebUI.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/Models/GroupMember.cs b/VolunterSite.WebUI/VolunteerSite.Domain/Models/GroupMember.cs new file mode 100644 index 0000000..748aa57 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/Models/GroupMember.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace VolunteerSite.Domain.Models +{ + public class GroupMember + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string PhoneNumber { get; set; } + public int TotalHours { get; set; } + + public string VolunteerGroupId { get; set; } + public VolunteerGroup VolunteerGroup { get; set; } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/Models/JobListing.cs b/VolunterSite.WebUI/VolunteerSite.Domain/Models/JobListing.cs new file mode 100644 index 0000000..915d6e1 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/Models/JobListing.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace VolunteerSite.Domain.Models +{ + public class JobListing + { + public int Id { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string State { get; set; } + public int PositionsAvailable { get; set; } + public string Description { get; set; } + public string TypeOfJob { get; set; } + public DateTime Date { get; set; } + + public string OrganizationId { get; set; } + public Organization Organization { get; set; } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/Models/Organization.cs b/VolunterSite.WebUI/VolunteerSite.Domain/Models/Organization.cs new file mode 100644 index 0000000..448779a --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/Models/Organization.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using VolunterSite.WebUI.Models; + +namespace VolunteerSite.Domain.Models +{ + public class Organization + { + public int Id { get; set; } + public string CompanyName { get; set; } + public string Address { get; set; } + public string City { get; set; } + public string State { get; set; } + public string Email { get; set; } + public string PhoneNumber { get; set; } + + public IEnumerable JobListings { get; set; } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/Models/Volunteer.cs b/VolunterSite.WebUI/VolunteerSite.Domain/Models/Volunteer.cs new file mode 100644 index 0000000..bda03d0 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/Models/Volunteer.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace VolunteerSite.Domain.Models +{ + public class Volunteer + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string PhoneNumber { get; set; } + public string SkillsAndExperience { get; set; } + + // Navigation Collection + public IEnumerable VolunteerGroups { get; set; } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/Models/VolunteerGroup.cs b/VolunterSite.WebUI/VolunteerSite.Domain/Models/VolunteerGroup.cs new file mode 100644 index 0000000..7fddf02 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/Models/VolunteerGroup.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace VolunteerSite.Domain.Models +{ + public class VolunteerGroup + { + public int Id { get; set; } + public string GroupName { get; set; } + + public string GroupOwnerId { get; set; } + public Volunteer GroupOwner { get; set; } + + public IEnumerable GroupMembers { get; set; } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.Domain/VolunteerSite.Domain.csproj b/VolunterSite.WebUI/VolunteerSite.Domain/VolunteerSite.Domain.csproj new file mode 100644 index 0000000..dbe0552 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.Domain/VolunteerSite.Domain.csproj @@ -0,0 +1,16 @@ + + + + netcoreapp2.2 + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Controllers/HomeController.cs b/VolunterSite.WebUI/VolunteerSite.WebUI/Controllers/HomeController.cs new file mode 100644 index 0000000..092f3c8 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Controllers/HomeController.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using VolunteerSite.WebUI.Models; + +namespace VolunteerSite.WebUI.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult Privacy() + { + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Models/ErrorViewModel.cs b/VolunterSite.WebUI/VolunteerSite.WebUI/Models/ErrorViewModel.cs new file mode 100644 index 0000000..2205216 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace VolunteerSite.WebUI.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Program.cs b/VolunterSite.WebUI/VolunteerSite.WebUI/Program.cs new file mode 100644 index 0000000..e0b7d22 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace VolunteerSite.WebUI +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Properties/launchSettings.json b/VolunterSite.WebUI/VolunteerSite.WebUI/Properties/launchSettings.json new file mode 100644 index 0000000..2b54a80 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55530", + "sslPort": 44312 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "VolunteerSite.WebUI": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Startup.cs b/VolunterSite.WebUI/VolunteerSite.WebUI/Startup.cs new file mode 100644 index 0000000..17bcb6c --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Startup.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using VolunteerSite.Data.Context; + +namespace VolunteerSite.WebUI +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.Configure(options => + { + // This lambda determines whether user consent for non-essential cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + options.MinimumSameSitePolicy = SameSiteMode.None; + }); + + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseStaticFiles(); + app.UseCookiePolicy(); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Home/Index.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Home/Index.cshtml new file mode 100644 index 0000000..d2d19bd --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +
+

Welcome

+

Learn about building Web apps with ASP.NET Core.

+
diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Home/Privacy.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Home/Privacy.cshtml new file mode 100644 index 0000000..af4fb19 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Home/Privacy.cshtml @@ -0,0 +1,6 @@ +@{ + ViewData["Title"] = "Privacy Policy"; +} +

@ViewData["Title"]

+ +

Use this page to detail your site's privacy policy.

diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/Error.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/Error.cshtml new file mode 100644 index 0000000..a1e0478 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/Error.cshtml @@ -0,0 +1,25 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_CookieConsentPartial.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_CookieConsentPartial.cshtml new file mode 100644 index 0000000..a535ea4 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_CookieConsentPartial.cshtml @@ -0,0 +1,25 @@ +@using Microsoft.AspNetCore.Http.Features + +@{ + var consentFeature = Context.Features.Get(); + var showBanner = !consentFeature?.CanTrack ?? false; + var cookieString = consentFeature?.CreateConsentCookie(); +} + +@if (showBanner) +{ + + +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_Layout.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..d9a0579 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_Layout.cshtml @@ -0,0 +1,77 @@ + + + + + + @ViewData["Title"] - VolunteerSite.WebUI + + + + + + + + + + +
+ +
+
+ +
+ @RenderBody() +
+
+ +
+
+ © 2019 - VolunteerSite.WebUI - Privacy +
+
+ + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_ValidationScriptsPartial.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000..3c0e077 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/_ViewImports.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/_ViewImports.cshtml new file mode 100644 index 0000000..94c63b5 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using VolunteerSite.WebUI +@using VolunteerSite.WebUI.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/Views/_ViewStart.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/VolunteerSite.WebUI.csproj b/VolunterSite.WebUI/VolunteerSite.WebUI/VolunteerSite.WebUI.csproj new file mode 100644 index 0000000..cb9cfff --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/VolunteerSite.WebUI.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.2 + InProcess + + + + + + + + + + + + + + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/appsettings.Development.json b/VolunterSite.WebUI/VolunteerSite.WebUI/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/appsettings.json b/VolunterSite.WebUI/VolunteerSite.WebUI/appsettings.json new file mode 100644 index 0000000..def9159 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/css/site.css b/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/css/site.css new file mode 100644 index 0000000..c486131 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/css/site.css @@ -0,0 +1,56 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + font-size: 14px; +} +@media (min-width: 768px) { + html { + font-size: 16px; + } +} + +.border-top { + border-top: 1px solid #e5e5e5; +} +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + position: relative; + min-height: 100%; +} + +body { + /* Margin bottom by footer height */ + margin-bottom: 60px; +} +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + /* Set the fixed height of the footer here */ + height: 60px; + line-height: 60px; /* Vertically center the text there */ +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/favicon.ico b/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/favicon.ico new file mode 100644 index 0000000..a3a7999 Binary files /dev/null and b/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/favicon.ico differ diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/js/site.js b/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/js/site.js new file mode 100644 index 0000000..ac49c18 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI/wwwroot/js/site.js @@ -0,0 +1,4 @@ +// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +// for details on configuring this project to bundle and minify static web assets. + +// Write your JavaScript code. diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Controllers/HomeController.cs b/VolunterSite.WebUI/VolunteerSite.WebUI2/Controllers/HomeController.cs new file mode 100644 index 0000000..9d98871 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Controllers/HomeController.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using VolunteerSite.WebUI2.Models; + +namespace VolunteerSite.WebUI2.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult Privacy() + { + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Models/ErrorViewModel.cs b/VolunterSite.WebUI/VolunteerSite.WebUI2/Models/ErrorViewModel.cs new file mode 100644 index 0000000..76b0e79 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace VolunteerSite.WebUI2.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Program.cs b/VolunterSite.WebUI/VolunteerSite.WebUI2/Program.cs new file mode 100644 index 0000000..07d96c0 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace VolunteerSite.WebUI2 +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Properties/launchSettings.json b/VolunterSite.WebUI/VolunteerSite.WebUI2/Properties/launchSettings.json new file mode 100644 index 0000000..5168021 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55509", + "sslPort": 44376 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "VolunteerSite.WebUI2": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Startup.cs b/VolunterSite.WebUI/VolunteerSite.WebUI2/Startup.cs new file mode 100644 index 0000000..1718a40 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Startup.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace VolunteerSite.WebUI2 +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.Configure(options => + { + // This lambda determines whether user consent for non-essential cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + options.MinimumSameSitePolicy = SameSiteMode.None; + }); + + + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseStaticFiles(); + app.UseCookiePolicy(); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Home/Index.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Home/Index.cshtml new file mode 100644 index 0000000..d2d19bd --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +
+

Welcome

+

Learn about building Web apps with ASP.NET Core.

+
diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Home/Privacy.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Home/Privacy.cshtml new file mode 100644 index 0000000..af4fb19 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Home/Privacy.cshtml @@ -0,0 +1,6 @@ +@{ + ViewData["Title"] = "Privacy Policy"; +} +

@ViewData["Title"]

+ +

Use this page to detail your site's privacy policy.

diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/Error.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/Error.cshtml new file mode 100644 index 0000000..a1e0478 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/Error.cshtml @@ -0,0 +1,25 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_CookieConsentPartial.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_CookieConsentPartial.cshtml new file mode 100644 index 0000000..a535ea4 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_CookieConsentPartial.cshtml @@ -0,0 +1,25 @@ +@using Microsoft.AspNetCore.Http.Features + +@{ + var consentFeature = Context.Features.Get(); + var showBanner = !consentFeature?.CanTrack ?? false; + var cookieString = consentFeature?.CreateConsentCookie(); +} + +@if (showBanner) +{ + + +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_Layout.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..5075eab --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_Layout.cshtml @@ -0,0 +1,77 @@ + + + + + + @ViewData["Title"] - VolunteerSite.WebUI2 + + + + + + + + + + +
+ +
+
+ +
+ @RenderBody() +
+
+ +
+
+ © 2019 - VolunteerSite.WebUI2 - Privacy +
+
+ + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_ValidationScriptsPartial.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000..3c0e077 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/_ViewImports.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/_ViewImports.cshtml new file mode 100644 index 0000000..fe7cfb0 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using VolunteerSite.WebUI2 +@using VolunteerSite.WebUI2.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/_ViewStart.cshtml b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/VolunteerSite.WebUI2.csproj b/VolunterSite.WebUI/VolunteerSite.WebUI2/VolunteerSite.WebUI2.csproj new file mode 100644 index 0000000..8b11822 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/VolunteerSite.WebUI2.csproj @@ -0,0 +1,14 @@ + + + + netcoreapp2.2 + InProcess + + + + + + + + + diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/appsettings.Development.json b/VolunterSite.WebUI/VolunteerSite.WebUI2/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/appsettings.json b/VolunterSite.WebUI/VolunteerSite.WebUI2/appsettings.json new file mode 100644 index 0000000..def9159 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/css/site.css b/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/css/site.css new file mode 100644 index 0000000..c486131 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/css/site.css @@ -0,0 +1,56 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + font-size: 14px; +} +@media (min-width: 768px) { + html { + font-size: 16px; + } +} + +.border-top { + border-top: 1px solid #e5e5e5; +} +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + position: relative; + min-height: 100%; +} + +body { + /* Margin bottom by footer height */ + margin-bottom: 60px; +} +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + /* Set the fixed height of the footer here */ + height: 60px; + line-height: 60px; /* Vertically center the text there */ +} diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/favicon.ico b/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/favicon.ico new file mode 100644 index 0000000..a3a7999 Binary files /dev/null and b/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/favicon.ico differ diff --git a/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/js/site.js b/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/js/site.js new file mode 100644 index 0000000..ac49c18 --- /dev/null +++ b/VolunterSite.WebUI/VolunteerSite.WebUI2/wwwroot/js/site.js @@ -0,0 +1,4 @@ +// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +// for details on configuring this project to bundle and minify static web assets. + +// Write your JavaScript code. diff --git a/VolunterSite.WebUI/VolunterSite.WebUI.sln b/VolunterSite.WebUI/VolunterSite.WebUI.sln new file mode 100644 index 0000000..baab1c3 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.271 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VolunteerSite.Domain", "VolunteerSite.Domain\VolunteerSite.Domain.csproj", "{2A3E4DBA-D5C8-4DA4-90F4-B360DF1056CC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VolunteerSite.Data", "VolunteerSite.Data\VolunteerSite.Data.csproj", "{00FA4408-CCC8-40A2-9DBD-328DD023DCF6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VolunteerSite.WebUI", "VolunteerSite.WebUI\VolunteerSite.WebUI.csproj", "{EDB8DF3C-02C9-4BBB-B71C-F99302C99583}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A3E4DBA-D5C8-4DA4-90F4-B360DF1056CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A3E4DBA-D5C8-4DA4-90F4-B360DF1056CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A3E4DBA-D5C8-4DA4-90F4-B360DF1056CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A3E4DBA-D5C8-4DA4-90F4-B360DF1056CC}.Release|Any CPU.Build.0 = Release|Any CPU + {00FA4408-CCC8-40A2-9DBD-328DD023DCF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00FA4408-CCC8-40A2-9DBD-328DD023DCF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00FA4408-CCC8-40A2-9DBD-328DD023DCF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00FA4408-CCC8-40A2-9DBD-328DD023DCF6}.Release|Any CPU.Build.0 = Release|Any CPU + {EDB8DF3C-02C9-4BBB-B71C-F99302C99583}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDB8DF3C-02C9-4BBB-B71C-F99302C99583}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDB8DF3C-02C9-4BBB-B71C-F99302C99583}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDB8DF3C-02C9-4BBB-B71C-F99302C99583}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {13551898-03AC-4F66-8AA6-9A5FCB40892F} + EndGlobalSection +EndGlobal diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Controllers/HomeController.cs b/VolunterSite.WebUI/VolunterSite.WebUI/Controllers/HomeController.cs new file mode 100644 index 0000000..cbd245b --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Controllers/HomeController.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using VolunterSite.WebUI.Models; + +namespace VolunterSite.WebUI.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult About() + { + ViewData["Message"] = "Your application description page."; + + return View(); + } + + public IActionResult Contact() + { + ViewData["Message"] = "Your contact page."; + + return View(); + } + + public IActionResult Privacy() + { + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Models/ErrorViewModel.cs b/VolunterSite.WebUI/VolunterSite.WebUI/Models/ErrorViewModel.cs new file mode 100644 index 0000000..8167476 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace VolunterSite.WebUI.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Program.cs b/VolunterSite.WebUI/VolunterSite.WebUI/Program.cs new file mode 100644 index 0000000..13daccf --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace VolunterSite.WebUI +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Properties/launchSettings.json b/VolunterSite.WebUI/VolunterSite.WebUI/Properties/launchSettings.json new file mode 100644 index 0000000..e92f707 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:60571", + "sslPort": 44345 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "VolunterSite.WebUI": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Startup.cs b/VolunterSite.WebUI/VolunterSite.WebUI/Startup.cs new file mode 100644 index 0000000..b7fb12e --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Startup.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace VolunterSite.WebUI +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // bad way of adding connection string + //TODO: fix later + var connectionString = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; + services.AddDbContext + + services.Configure(options => + { + // This lambda determines whether user consent for non-essential cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + options.MinimumSameSitePolicy = SameSiteMode.None; + }); + + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseStaticFiles(); + app.UseCookiePolicy(); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/About.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/About.cshtml new file mode 100644 index 0000000..3674e37 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/About.cshtml @@ -0,0 +1,7 @@ +@{ + ViewData["Title"] = "About"; +} +

@ViewData["Title"]

+

@ViewData["Message"]

+ +

Use this area to provide additional information.

diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Contact.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Contact.cshtml new file mode 100644 index 0000000..a11a186 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Contact.cshtml @@ -0,0 +1,17 @@ +@{ + ViewData["Title"] = "Contact"; +} +

@ViewData["Title"]

+

@ViewData["Message"]

+ +
+ One Microsoft Way
+ Redmond, WA 98052-6399
+ P: + 425.555.0100 +
+ +
+ Support: Support@example.com
+ Marketing: Marketing@example.com +
diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Index.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Index.cshtml new file mode 100644 index 0000000..f42d2a0 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Index.cshtml @@ -0,0 +1,94 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Privacy.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Privacy.cshtml new file mode 100644 index 0000000..7bd3861 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Home/Privacy.cshtml @@ -0,0 +1,6 @@ +@{ + ViewData["Title"] = "Privacy Policy"; +} +

@ViewData["Title"]

+ +

Use this page to detail your site's privacy policy.

diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/Error.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/Error.cshtml new file mode 100644 index 0000000..ec2ea6b --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/Error.cshtml @@ -0,0 +1,22 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_CookieConsentPartial.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_CookieConsentPartial.cshtml new file mode 100644 index 0000000..bbfbb09 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_CookieConsentPartial.cshtml @@ -0,0 +1,41 @@ +@using Microsoft.AspNetCore.Http.Features + +@{ + var consentFeature = Context.Features.Get(); + var showBanner = !consentFeature?.CanTrack ?? false; + var cookieString = consentFeature?.CreateConsentCookie(); +} + +@if (showBanner) +{ + + +} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_Layout.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..43e56e5 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_Layout.cshtml @@ -0,0 +1,74 @@ + + + + + + @ViewData["Title"] - VolunterSite.WebUI + + + + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2019 - VolunterSite.WebUI

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_ValidationScriptsPartial.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000..2a9241f --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/_ViewImports.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/_ViewImports.cshtml new file mode 100644 index 0000000..8c97aa0 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using VolunterSite.WebUI +@using VolunterSite.WebUI.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/Views/_ViewStart.cshtml b/VolunterSite.WebUI/VolunterSite.WebUI/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/VolunterSite.WebUI.csproj b/VolunterSite.WebUI/VolunterSite.WebUI/VolunterSite.WebUI.csproj new file mode 100644 index 0000000..efb8edb --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/VolunterSite.WebUI.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp2.1 + + + + + + + + diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/appsettings.Development.json b/VolunterSite.WebUI/VolunterSite.WebUI/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/appsettings.json b/VolunterSite.WebUI/VolunterSite.WebUI/appsettings.json new file mode 100644 index 0000000..def9159 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/css/site.css b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/css/site.css new file mode 100644 index 0000000..e89c781 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/css/site.css @@ -0,0 +1,37 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification\ +for details on configuring this project to bundle and minify static web assets. */ +body { + padding-top: 50px; + padding-bottom: 20px; +} + +/* Wrapping element */ +/* Set some basic padding to keep content from hitting the edges */ +.body-content { + padding-left: 15px; + padding-right: 15px; +} + +/* Carousel */ +.carousel-caption p { + font-size: 20px; + line-height: 1.4; +} + +/* Make .svg files in the carousel display properly in older browsers */ +.carousel-inner .item img[src$=".svg"] { + width: 100%; +} + +/* QR code generator */ +#qrCode { + margin: 15px; +} + +/* Hide/rearrange for smaller screens */ +@media screen and (max-width: 767px) { + /* Hide captions */ + .carousel-caption { + display: none; + } +} diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/css/site.min.css b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/css/site.min.css new file mode 100644 index 0000000..5e93e30 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/css/site.min.css @@ -0,0 +1 @@ +body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/favicon.ico b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/favicon.ico new file mode 100644 index 0000000..a3a7999 Binary files /dev/null and b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/favicon.ico differ diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner1.svg b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner1.svg new file mode 100644 index 0000000..1ab32b6 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner2.svg b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner2.svg new file mode 100644 index 0000000..9679c60 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner3.svg b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner3.svg new file mode 100644 index 0000000..38b3d7c --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/images/banner3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/js/site.js b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/js/site.js new file mode 100644 index 0000000..ac49c18 --- /dev/null +++ b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/js/site.js @@ -0,0 +1,4 @@ +// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +// for details on configuring this project to bundle and minify static web assets. + +// Write your JavaScript code. diff --git a/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/js/site.min.js b/VolunterSite.WebUI/VolunterSite.WebUI/wwwroot/js/site.min.js new file mode 100644 index 0000000..e69de29