diff --git a/CourseNet.Data.Models/Entities/Course.cs b/CourseNet.Data.Models/Entities/Course.cs index cb6d92a..a25da63 100644 --- a/CourseNet.Data.Models/Entities/Course.cs +++ b/CourseNet.Data.Models/Entities/Course.cs @@ -74,9 +74,6 @@ public Course() [Comment("Collection of Categories")] public virtual ICollection Categories { get; set; } = new HashSet(); - //[Comment("Collection of Students")] - //public virtual ICollection Students { get; set; } = new HashSet(); - [Comment("Collection of Lectures")] public virtual ICollection Lectures { get; set; } = new HashSet(); diff --git a/CourseNet.Data.Models/Entities/Enums/CourseStatus.cs b/CourseNet.Data.Models/Entities/Enums/CourseStatus.cs index d2ec131..10af704 100644 --- a/CourseNet.Data.Models/Entities/Enums/CourseStatus.cs +++ b/CourseNet.Data.Models/Entities/Enums/CourseStatus.cs @@ -3,7 +3,6 @@ public enum CourseStatus { Active, - Inactive, Completed, Archived } diff --git a/CourseNet.Data.Models/Entities/Material.cs b/CourseNet.Data.Models/Entities/Material.cs index e822dd1..639002f 100644 --- a/CourseNet.Data.Models/Entities/Material.cs +++ b/CourseNet.Data.Models/Entities/Material.cs @@ -1,7 +1,6 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using CourseNet.Common.DataConstants; using static CourseNet.Common.DataConstants.Material; namespace CourseNet.Data.Models.Entities { diff --git a/CourseNet.Web.Infrastructure/ModelBinders/DecimalModelBinderProvider.cs b/CourseNet.Web.Infrastructure/ModelBinders/DecimalModelBinderProvider.cs index 316c43d..c6de567 100644 --- a/CourseNet.Web.Infrastructure/ModelBinders/DecimalModelBinderProvider.cs +++ b/CourseNet.Web.Infrastructure/ModelBinders/DecimalModelBinderProvider.cs @@ -4,13 +4,16 @@ namespace CourseNet.Web.Infrastructure.ModelBinders { public class DecimalModelBinderProvider : IModelBinderProvider { + // ModelBinderProviderContext is a context object for creating an IModelBinder. public IModelBinder GetBinder(ModelBinderProviderContext context) { + // If the context is null, throw an ArgumentNullException. if (context == null) { throw new ArgumentNullException(nameof(context)); } - + // If the model type is decimal or decimal?, return a new DecimalModelBinder. + // The DecimalModelBinder is a custom model binder for decimal and decimal? types. if (context.Metadata.ModelType == typeof(decimal) || context.Metadata.ModelType == typeof(decimal?)) { return new DecimalModelBinder(); diff --git a/CourseNet.Web.ViewModels/User/LoginFormModel.cs b/CourseNet.Web.ViewModels/User/LoginFormModel.cs index 5feebfb..4984629 100644 --- a/CourseNet.Web.ViewModels/User/LoginFormModel.cs +++ b/CourseNet.Web.ViewModels/User/LoginFormModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; namespace CourseNet.Web.ViewModels.User { diff --git a/CourseNet.Web.ViewModels/User/UserViewModel.cs b/CourseNet.Web.ViewModels/User/UserViewModel.cs index 39948cc..3bfb395 100644 --- a/CourseNet.Web.ViewModels/User/UserViewModel.cs +++ b/CourseNet.Web.ViewModels/User/UserViewModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CourseNet.Web.ViewModels.User +namespace CourseNet.Web.ViewModels.User { public class UserViewModel { diff --git a/CourseNet/Controllers/CategoriesController.cs b/CourseNet/Controllers/CategoriesController.cs index 3aed875..f496411 100644 --- a/CourseNet/Controllers/CategoriesController.cs +++ b/CourseNet/Controllers/CategoriesController.cs @@ -257,7 +257,6 @@ private IActionResult GeneralError() { TempData[ErrorMessage] = GeneralErrorMessage; return RedirectToAction("Index", "Home"); - } } } diff --git a/CourseNet/StartUp.cs b/CourseNet/StartUp.cs index 34b68d3..9f36e8f 100644 --- a/CourseNet/StartUp.cs +++ b/CourseNet/StartUp.cs @@ -40,6 +40,7 @@ cfg.AccessDeniedPath = "/Home/Error/401"; }); +// Add services to the container automatically due to the ModelBinderProvider. builder.Services .AddControllersWithViews() .AddMvcOptions(options => diff --git a/CourseNet/Views/User/Register.cshtml b/CourseNet/Views/User/Register.cshtml index 1e9f0a5..80c2aba 100644 --- a/CourseNet/Views/User/Register.cshtml +++ b/CourseNet/Views/User/Register.cshtml @@ -35,7 +35,7 @@ - Register + Регистрирай се