diff --git a/CustomAnalysisRules.Test.ruleset b/CustomAnalysisRules.Test.ruleset
new file mode 100644
index 0000000..3bf88dc
--- /dev/null
+++ b/CustomAnalysisRules.Test.ruleset
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CustomAnalysisRules.ruleset b/CustomAnalysisRules.ruleset
new file mode 100644
index 0000000..bf0147b
--- /dev/null
+++ b/CustomAnalysisRules.ruleset
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..5574872
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,44 @@
+
+
+ true
+
+ Full
+ 7.3
+ true
+ false
+ $(EnableSourceLink)
+
+ true
+
+
+
+ true
+ true
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+
+
+
+
+ false
+ $(MSBuildThisFileDirectory)\CustomAnalysisRules.Test.ruleset
+
+
+
+
+ true
+ $(MSBuildThisFileDirectory)\CustomAnalysisRules.ruleset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/CSInn.Domain.Repositories/ILessonsRepository.cs b/src/CSInn.Domain.Repositories/ILessonsRepository.cs
index 874bdc2..b161052 100644
--- a/src/CSInn.Domain.Repositories/ILessonsRepository.cs
+++ b/src/CSInn.Domain.Repositories/ILessonsRepository.cs
@@ -1,6 +1,11 @@
-using CSInn.Domain.Models.Content;
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
using System;
using System.Collections.Generic;
+using CSInn.Domain.Models.Content;
namespace CSInn.Domain.Repositories
{
@@ -8,8 +13,11 @@ public interface ILessonsRepository : IRepository
{
// TODO: Specification pattern so we can mix criterias.
IEnumerable GetByTags(params string[] tags);
+
IEnumerable GetByName(string name);
+
IEnumerable GetByAuthors(params string[] authors);
+
IEnumerable GetByDate(DateTime from, DateTime to);
}
}
diff --git a/src/CSInn.Domain.Repositories/IRepository.cs b/src/CSInn.Domain.Repositories/IRepository.cs
index f4f6192..5221315 100644
--- a/src/CSInn.Domain.Repositories/IRepository.cs
+++ b/src/CSInn.Domain.Repositories/IRepository.cs
@@ -1,15 +1,23 @@
-using System;
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
using System.Collections.Generic;
-using System.Text;
namespace CSInn.Domain.Repositories
{
- public interface IRepository where TModel : class
+ public interface IRepository
+ where TModel : class
{
void Create(TModel model);
+
void Update(TModel model);
+
void Delete(int key);
+
IEnumerable Get();
+
TModel Get(int id);
}
}
diff --git a/src/CSInn.Models/Exceptions/InvalidLessonException.cs b/src/CSInn.Models/Exceptions/InvalidLessonException.cs
index a215143..14a170c 100644
--- a/src/CSInn.Models/Exceptions/InvalidLessonException.cs
+++ b/src/CSInn.Models/Exceptions/InvalidLessonException.cs
@@ -1,15 +1,18 @@
-using System;
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
+using System;
using System.Collections.Generic;
-using System.Text;
namespace CSInn.Domain.Models.Content.Exceptions
{
public class InvalidLessonException : Exception
{
- public InvalidLessonException(bool isTitleEmpty, bool isDescriptionEmpty, bool areNoTags, bool areNoAuthors):
- base(BuildErrorMessage(isTitleEmpty, isDescriptionEmpty, areNoTags, areNoAuthors))
+ public InvalidLessonException(bool isTitleEmpty, bool isDescriptionEmpty, bool areNoTags, bool areNoAuthors)
+ : base(BuildErrorMessage(isTitleEmpty, isDescriptionEmpty, areNoTags, areNoAuthors))
{
-
}
private static string BuildErrorMessage(bool isTitleEmpty, bool isDescriptionEmpty, bool areNoTags, bool areNoAuthors)
diff --git a/src/CSInn.Models/Lesson.cs b/src/CSInn.Models/Lesson.cs
index cb9bc50..bffde95 100644
--- a/src/CSInn.Models/Lesson.cs
+++ b/src/CSInn.Models/Lesson.cs
@@ -1,30 +1,24 @@
-/*
- * should we allow users to upload attachments that they may think help users in theirendeavor for learning?
- *
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
+/*
+ * should we allow users to upload attachments that they may think help users in theirendeavor for learning?
+ *
* Example: User uploads a database for another user to use, or uploads code snippets/examples for users
* to play with or understand the code?
- *
- */
+ *
+ */
-
-
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using CSInn.Domain.Models.Content.Exceptions;
namespace CSInn.Domain.Models.Content
{
public class Lesson
{
- public string Title { get; }
- public string Description { get; set; }
- public string Video { get; set; }
- public string Slides { get; set; }
- public IList Tags { get; set; }
- public IList Authors { get; }
-
public Lesson(string title, string description, IEnumerable tags, IEnumerable authors)
{
Title = title;
@@ -41,8 +35,18 @@ public Lesson(string title, string description, IEnumerable tags, IEnume
{
throw new InvalidLessonException(isTitleEmpty, isDescriptionEmpty, areNoTags, areNoAuthors);
}
-
}
- }
+ public string Title { get; }
+
+ public string Description { get; set; }
+
+ public string Video { get; set; }
+
+ public string Slides { get; set; }
+
+ public IList Tags { get; set; }
+
+ public IList Authors { get; }
+ }
}
diff --git a/src/CSInn.UI/Data/WeatherForecast.cs b/src/CSInn.UI/Data/WeatherForecast.cs
index 02ccfdb..6ee2521 100644
--- a/src/CSInn.UI/Data/WeatherForecast.cs
+++ b/src/CSInn.UI/Data/WeatherForecast.cs
@@ -1,3 +1,8 @@
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
using System;
namespace CSInn.Data
diff --git a/src/CSInn.UI/Data/WeatherForecastService.cs b/src/CSInn.UI/Data/WeatherForecastService.cs
index d692d70..022e234 100644
--- a/src/CSInn.UI/Data/WeatherForecastService.cs
+++ b/src/CSInn.UI/Data/WeatherForecastService.cs
@@ -1,3 +1,8 @@
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
using System;
using System.Linq;
using System.Threading.Tasks;
@@ -8,7 +13,7 @@ public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching",
};
public Task GetForecastAsync(DateTime startDate)
@@ -18,7 +23,7 @@ public Task GetForecastAsync(DateTime startDate)
{
Date = startDate.AddDays(index),
TemperatureC = rng.Next(-20, 55),
- Summary = Summaries[rng.Next(Summaries.Length)]
+ Summary = Summaries[rng.Next(Summaries.Length)],
}).ToArray());
}
}
diff --git a/src/CSInn.UI/Program.cs b/src/CSInn.UI/Program.cs
index 6e0bada..7086c45 100644
--- a/src/CSInn.UI/Program.cs
+++ b/src/CSInn.UI/Program.cs
@@ -1,13 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
namespace CSInn
{
diff --git a/src/CSInn.UI/Startup.cs b/src/CSInn.UI/Startup.cs
index 5ecc549..e0e3937 100644
--- a/src/CSInn.UI/Startup.cs
+++ b/src/CSInn.UI/Startup.cs
@@ -1,15 +1,14 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+// -------------------------------------------------------------------------------------------------
+// C# Inn Website - © Copyright 2020 - C# Inn
+// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
+// -------------------------------------------------------------------------------------------------
+
+using CSInn.Data;
using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using CSInn.Data;
namespace CSInn
{
@@ -41,6 +40,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
else
{
app.UseExceptionHandler("/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();
}
diff --git a/stylecop.json b/stylecop.json
new file mode 100644
index 0000000..79aa590
--- /dev/null
+++ b/stylecop.json
@@ -0,0 +1,27 @@
+{
+ "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
+ "settings": {
+ "documentationRules": {
+ "companyName": "C# Inn",
+ "copyrightText": "-------------------------------------------------------------------------------------------------\nC# Inn Website - © Copyright 2020 - {companyName}\nLicensed under the {licenseName} License ({licenseName}). See {licenseFile} in the repo root for license information.\n-------------------------------------------------------------------------------------------------",
+ "variables": {
+ "licenseName": "MIT",
+ "licenseFile": "LICENSE"
+ },
+ "xmlHeader": false,
+ "headerDecoration": "-------------------------------------------------------------------------------------------------"
+ },
+ "orderingRules": {
+ "systemUsingDirectivesFirst": true,
+ "usingDirectivesPlacement": "outsideNamespace",
+ "elementOrder": [
+ "kind"
+ ]
+ },
+ "indentation": {
+ "useTabs": false,
+ "indentationSize": 4,
+ "tabSize": 4
+ }
+ }
+}