Добавлены модели: User для дополнительного описания сущности пользователя, в виде Имени и Фамилии.

Film для описания сущности фильма.
Определены и добавлены следующие nuget-пакеты :
Identity, efCore Design, Proxies, Sqlite.Core
Настроена конфигурация используемой БД.
Добавлена начальная миграция
parent 2cd3cdf2
...@@ -10,8 +10,18 @@ ...@@ -10,8 +10,18 @@
<e p="Controllers" t="Include"> <e p="Controllers" t="Include">
<e p="HomeController.cs" t="Include" /> <e p="HomeController.cs" t="Include" />
</e> </e>
<e p="Data" t="Include">
<e p="CinemaContext.cs" t="Include" />
</e>
<e p="Migrations" t="Include">
<e p="20201119082753_Initial.Designer.cs" t="Include" />
<e p="20201119082753_Initial.cs" t="Include" />
<e p="CinemaContextModelSnapshot.cs" t="Include" />
</e>
<e p="Models" t="Include"> <e p="Models" t="Include">
<e p="ErrorViewModel.cs" t="Include" /> <e p="ErrorViewModel.cs" t="Include" />
<e p="Film.cs" t="Include" />
<e p="User.cs" t="Include" />
</e> </e>
<e p="Program.cs" t="Include" /> <e p="Program.cs" t="Include" />
<e p="Properties" t="Include"> <e p="Properties" t="Include">
......
...@@ -3,8 +3,17 @@ ...@@ -3,8 +3,17 @@
<component name="AutoGeneratedRunConfigurationManager"> <component name="AutoGeneratedRunConfigurationManager">
<projectFile>Cinema.csproj</projectFile> <projectFile>Cinema.csproj</projectFile>
</component> </component>
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="411e953d-ac1b-431b-8c52-f61006a5f2f2" name="Default Changelist" comment="" /> <list default="true" id="411e953d-ac1b-431b-8c52-f61006a5f2f2" name="Default Changelist" comment="Добавлены модели: User для дополнительного описания сущности пользователя, в виде Имени и Фамилии.&#10;Film для описания сущности фильма.&#10;Определены и добавлены следующие nuget-пакеты :&#10;Identity, efCore Design, Proxies, Sqlite.Core&#10;Настроена конфигурация используемой БД.&#10;Добавлена начальная миграция" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
...@@ -13,6 +22,20 @@ ...@@ -13,6 +22,20 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/E861A8F7-CA3E-4C3E-8C40-5FD7641920A2/3/IdentityUserContext.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/F9B7D2EE-C4FD-432F-A52C-CB3A9E9DE266/3/IdentityUser.cs" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/Models/Film.cs" />
<option value="$PROJECT_DIR$/Models/User.cs" />
<option value="$PROJECT_DIR$/Data/CinemaContext.cs" />
<option value="$PROJECT_DIR$/Startup.cs" />
</list>
</option>
</component>
<component name="ProjectId" id="1kV2cNChUlsihpPBa0Dqsujl9SA" /> <component name="ProjectId" id="1kV2cNChUlsihpPBa0Dqsujl9SA" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState"> <component name="ProjectViewState">
...@@ -22,6 +45,7 @@ ...@@ -22,6 +45,7 @@
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="vue.rearranger.settings.migration" value="true" /> <property name="vue.rearranger.settings.migration" value="true" />
</component> </component>
<component name="RunManager" selected=".NET Launch Settings Profile.Cinema"> <component name="RunManager" selected=".NET Launch Settings Profile.Cinema">
...@@ -64,8 +88,23 @@ ...@@ -64,8 +88,23 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1605771522746</updated> <updated>1605771522746</updated>
<workItem from="1605771536927" duration="651000" /> <workItem from="1605771536927" duration="3273000" />
</task>
<task id="LOCAL-00001" summary="Начало проекта">
<created>1605772561160</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1605772561160</updated>
</task> </task>
<task id="LOCAL-00002" summary="Добавлены модели: User для дополнительного описания сущности пользователя, в виде Имени и Фамилии.&#10;Film для описания сущности фильма.&#10;Определены и добавлены следующие nuget-пакеты :&#10;Identity, efCore Design, Proxies, Sqlite.Core&#10;Настроена конфигурация используемой БД.&#10;Добавлена начальная миграция">
<created>1605774749200</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1605774749200</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
...@@ -73,7 +112,31 @@ ...@@ -73,7 +112,31 @@
</component> </component>
<component name="UnityProjectConfiguration" hasMinimizedUI="null" /> <component name="UnityProjectConfiguration" hasMinimizedUI="null" />
<component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" /> <component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" />
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" /> <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="Начало проекта" />
<MESSAGE value="Добавлены модели: User для дополнительного описания сущности пользователя, в виде Имени и Фамилии.&#10;Film для описания сущности фильма.&#10;Определены и добавлены следующие nuget-пакеты :&#10;Identity, efCore Design, Proxies, Sqlite.Core&#10;Настроена конфигурация используемой БД.&#10;Добавлена начальная миграция" />
<option name="LAST_COMMIT_MESSAGE" value="Добавлены модели: User для дополнительного описания сущности пользователя, в виде Имени и Фамилии.&#10;Film для описания сущности фильма.&#10;Определены и добавлены следующие nuget-пакеты :&#10;Identity, efCore Design, Proxies, Sqlite.Core&#10;Настроена конфигурация используемой БД.&#10;Добавлена начальная миграция" />
</component>
<component name="WindowStateProjectService">
<state x="644" y="228" width="622" height="585" key="RiderGenerateDialog" timestamp="1605774080803">
<screen x="0" y="0" width="1920" height="1044" />
</state>
<state x="644" y="228" width="622" height="585" key="RiderGenerateDialog/0.0.1920.1044/1920.0.1920.1080@0.0.1920.1044" timestamp="1605774080803" />
<state x="555" y="258" width="800" height="525" key="Vcs.Push.Dialog.v2" timestamp="1605772198575">
<screen x="0" y="0" width="1920" height="1044" />
</state>
<state x="555" y="258" width="800" height="525" key="Vcs.Push.Dialog.v2/0.0.1920.1044/1920.0.1920.1080@0.0.1920.1044" timestamp="1605772198575" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -4,4 +4,14 @@ ...@@ -4,4 +4,14 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.10" />
</ItemGroup>
</Project> </Project>
using Cinema.Models;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace Cinema.Data
{
public class CinemaContext : IdentityDbContext<User>
{
public DbSet<Film> Films { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite("Data Source=cinema.db");
public CinemaContext(DbContextOptions options) : base(options)
{
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
using System;
namespace Cinema.Models
{
public class Film
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Poster { get; set; }
public int PublishYear { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public string UserId { get; set; }
public User User { get; set; }
}
}
\ No newline at end of file
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;
namespace Cinema.Models
{
public class User : IdentityUser
{
public string FirstName { get; set; }
public string SecondName { get; set; }
public virtual List<Film> Films { get; set; }
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ using System; ...@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Cinema.Data;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.HttpsPolicy;
...@@ -19,14 +20,13 @@ namespace Cinema ...@@ -19,14 +20,13 @@ namespace Cinema
} }
public IConfiguration Configuration { get; } 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) public void ConfigureServices(IServiceCollection services)
{ {
services.AddControllersWithViews(); services.AddControllersWithViews();
services.AddDbContext<CinemaContext>();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
if (env.IsDevelopment()) if (env.IsDevelopment())
...@@ -36,7 +36,7 @@ namespace Cinema ...@@ -36,7 +36,7 @@ namespace Cinema
else else
{ {
app.UseExceptionHandler("/Home/Error"); 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.UseHsts();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment