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
12 changes: 9 additions & 3 deletions ratemyprofessors.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ratemyprofessors", "ratemyprofessors\ratemyprofessors.csproj", "{6C93947B-F731-4AB7-98CE-53DAC00068C3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ratemyprofessors", "ratemyprofessors\ratemyprofessors.csproj", "{6C93947B-F731-4AB7-98CE-53DAC00068C3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ratemyprofessorsTests", "ratemyprofessorsTests\ratemyprofessorsTests.csproj", "{FA13E8EA-3296-4746-AA25-17F759815C81}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +17,10 @@ Global
{6C93947B-F731-4AB7-98CE-53DAC00068C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C93947B-F731-4AB7-98CE-53DAC00068C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C93947B-F731-4AB7-98CE-53DAC00068C3}.Release|Any CPU.Build.0 = Release|Any CPU
{FA13E8EA-3296-4746-AA25-17F759815C81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA13E8EA-3296-4746-AA25-17F759815C81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA13E8EA-3296-4746-AA25-17F759815C81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA13E8EA-3296-4746-AA25-17F759815C81}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 2 additions & 0 deletions ratemyprofessors/Controllers/CoursesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public IEnumerable<Course> GetAllCourses()
return _context.Courses.Where(x => x.Approved);
}
// POST: api/Courses

// TODO Check Facility IsFound And If Not Return BadRequest
[HttpPost]
public async Task<IActionResult> PostCourses([FromBody] Course course)
{
Expand Down
1 change: 1 addition & 0 deletions ratemyprofessors/Controllers/ProfessorsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public IActionResult GetProfessorsByFac([FromRoute] string id)


// POST: api/Professors
// TODO Return BadRequest on model error.
[HttpPost("NewProf")]
public async Task<IActionResult> PostProfessor([FromBody] Professor professor)
{
Expand Down
7 changes: 6 additions & 1 deletion ratemyprofessors/ProfessorCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ public ProfessorCache(IConfiguration configuration)
}
private void Update()
{
//var OptionsBuilder = new DbContextOptionsBuilder<DataBaseContext>();
//OptionsBuilder.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));
//List<Professor> ProfsL;

var OptionsBuilder = new DbContextOptionsBuilder<DataBaseContext>();
OptionsBuilder.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));
OptionsBuilder.UseInMemoryDatabase(databaseName: "cache database");
List<Professor> ProfsL;

using (var DB = new DataBaseContext(OptionsBuilder.Options))
{
ProfsL = DB.Professors
Expand Down
5 changes: 4 additions & 1 deletion ratemyprofessors/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//services.AddDbContext<DataBaseContext>(options =>
// options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

services.AddDbContext<DataBaseContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
options.UseInMemoryDatabase(databaseName: "base_project_db"));

services.AddSingleton<ProfessorCache>();

Expand Down
2 changes: 1 addition & 1 deletion ratemyprofessors/ratemyprofessors.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
Expand Down
Loading