Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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 VolunteerSiteDbContext(DbContextOptions<VolunteerSiteDbContext> options): base(options) { }

public DbSet<Volunteer> Volunteers { get; set; }
public DbSet<VolunteerGroup> VolunteerGroups { get; set; }
public DbSet<Organization> Organizations { get; set; }
public DbSet<JobListing> JobListings { get; set; }
public DbSet<GroupMember> 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");
}

//Seeding - populate db with initial data

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -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<GroupMember> GetByGroupId(int groupId);

//create
GroupMember Create(GroupMember newGroupMember);

//Update
GroupMember Update(GroupMember UpdatedGroupMember);

//Delete
bool DeleteById(int groupMemberId);
}
}
Original file line number Diff line number Diff line change
@@ -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<JobListing> GetByOrganizationId(string organizationId);
ICollection<JobListing> GetByTypeOfJob(string typeOfJob);

// Create
JobListing Create(JobListing newJobListing);

//Update
JobListing Update(JobListing updatedJobListing);

//Delete
bool DeleteById(int jobListingId);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading