-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e91cf1e
commit c39d419
Showing
38 changed files
with
5,122 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28307.106 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cinema", "Cinema\Cinema.csproj", "{48DA9A16-0B45-4C96-9C1C-AE6433667B1F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{48DA9A16-0B45-4C96-9C1C-AE6433667B1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{48DA9A16-0B45-4C96-9C1C-AE6433667B1F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{48DA9A16-0B45-4C96-9C1C-AE6433667B1F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{48DA9A16-0B45-4C96-9C1C-AE6433667B1F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3BA85C81-DFC6-4D53-8B70-2E03A3758900} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoMapper" Version="8.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> | ||
</ItemGroup> | ||
|
||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using AutoMapper; | ||
|
||
namespace Cinema | ||
{ | ||
public class CinemaProfile : Profile | ||
{ | ||
// Configure your AutoMapper here if you wish to use it. If not, DO NOT DELETE THIS CLASS | ||
public CinemaProfile() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Cinema.Data | ||
{ | ||
using Cinema.Data.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
public class CinemaContext : DbContext | ||
{ | ||
public CinemaContext() { } | ||
|
||
public CinemaContext(DbContextOptions options) | ||
: base(options) { } | ||
|
||
public DbSet<Seat> Seats { get; set; } | ||
public DbSet<Ticket> Tickets { get; set; } | ||
public DbSet<Customer> Customers { get; set; } | ||
public DbSet<Hall> Halls { get; set; } | ||
public DbSet<Projection> Projections { get; set; } | ||
public DbSet<Movie> Movies{ get; set; } | ||
|
||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
if (!optionsBuilder.IsConfigured) | ||
{ | ||
optionsBuilder | ||
.UseSqlServer(Configuration.ConnectionString); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Cinema.Data | ||
{ | ||
public static class Configuration | ||
{ | ||
public static string ConnectionString = @"Server=.;Database=Cinema;Trusted_Connection=True"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Cinema.Data.Models | ||
{ | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
public class Customer | ||
{ | ||
public int Id { get; set; } | ||
|
||
[MinLength(3), MaxLength(20)] | ||
[Required] | ||
public string FirstName { get; set; } | ||
|
||
[MinLength(3), MaxLength(20)] | ||
[Required] | ||
public string LastName { get; set; } | ||
|
||
[Range(12,110)] | ||
[Required] | ||
public int Age { get; set; } | ||
|
||
[Required] | ||
[Range(typeof(decimal), "0.01", "79228162514264337593543950335")] | ||
public decimal Balance { get; set; } | ||
|
||
public ICollection<Ticket> Tickets { get; set; } = new HashSet<Ticket>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Cinema.Data.Models.Enums | ||
{ | ||
public enum Genre | ||
{ | ||
Action, | ||
Drama, | ||
Comedy, | ||
Crime, | ||
Western, | ||
Romance, | ||
Documentary, | ||
Children, | ||
Animation, | ||
Musical | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace Cinema.Data.Models | ||
{ | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
public class Hall | ||
{ | ||
public int Id { get; set; } | ||
|
||
[Required] | ||
[MinLength(3), MaxLength(20)] | ||
public string Name { get; set; } | ||
|
||
[Required] | ||
public bool Is4Dx { get; set; } | ||
|
||
[Required] | ||
public bool Is3D { get; set; } | ||
|
||
public ICollection<Projection> Projections { get; set; } = new HashSet<Projection>(); | ||
|
||
public ICollection<Seat> Seats { get; set; } = new HashSet<Seat>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Cinema.Data.Models | ||
{ | ||
using Cinema.Data.Models.Enums; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
public class Movie | ||
{ | ||
public int Id { get; set; } | ||
|
||
[Required] | ||
[MinLength(3), MaxLength(20)] | ||
public string Title { get; set; } | ||
|
||
[Required] | ||
public Genre Genre { get; set; } | ||
|
||
[Required] | ||
public TimeSpan Duration { get; set; } | ||
|
||
[Range(1, 10)] | ||
[Required] | ||
public double Rating { get; set; } | ||
|
||
[Required] | ||
[MinLength(3), MaxLength(20)] | ||
public string Director { get; set; } | ||
|
||
public ICollection<Projection> Projections { get; set; } = new HashSet<Projection>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace Cinema.Data.Models | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
public class Projection | ||
{ | ||
public int Id { get; set; } | ||
|
||
[Required] | ||
[ForeignKey(nameof(Movie))] | ||
public int MovieId { get; set; } | ||
public Movie Movie { get; set; } | ||
|
||
[ForeignKey(nameof(Hall))] | ||
[Required] | ||
public int HallId { get; set; } | ||
public Hall Hall { get; set; } | ||
|
||
[Required] | ||
public DateTime DateTime { get; set; } | ||
|
||
public ICollection<Ticket> Tickets { get; set; } = new HashSet<Ticket>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Cinema.Data.Models | ||
{ | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
public class Seat | ||
{ | ||
public int Id { get; set; } | ||
|
||
[Required] | ||
[ForeignKey(nameof(Hall))] | ||
public int HallId { get; set; } | ||
public Hall Hall { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace Cinema.Data.Models | ||
{ | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
public class Ticket | ||
{ | ||
public int Id { get; set; } | ||
|
||
[Range(typeof(decimal), "0.01", "79228162514264337593543950335")] | ||
[Required] | ||
public decimal Price { get; set; } | ||
|
||
[Required] | ||
[ForeignKey(nameof(Customer))] | ||
public int CustomerId { get; set; } | ||
public Customer Customer { get; set; } | ||
|
||
[Required] | ||
[ForeignKey(nameof(Projection))] | ||
public int ProjectionId { get; set; } | ||
public Projection Projection { get; set; } | ||
} | ||
} |
Oops, something went wrong.