Page design, remove migration, edit foreign key
This commit is contained in:
@@ -1,405 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
namespace Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(RentACarDbContext))]
|
|
||||||
[Migration("20220407201957_migrena")]
|
|
||||||
partial class migrena
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
|
||||||
.HasAnnotation("ProductVersion", "5.0.15")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.Car", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<string>("Brand")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("CountPassengerSeats")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<decimal>("PriceForDay")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Year")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Cars");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.Rents", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<int>("CarId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime>("StartDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CarId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Rents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.User", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("FirstName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("LastName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("datetimeoffset");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PersonalNumber")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
|
||||||
.HasDatabaseName("EmailIndex");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedUserName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("UserNameIndex")
|
|
||||||
.HasFilter("[NormalizedUserName] IS NOT NULL");
|
|
||||||
|
|
||||||
b.HasIndex("PersonalNumber")
|
|
||||||
.IsUnique()
|
|
||||||
.HasFilter("[PersonalNumber] IS NOT NULL");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUsers");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = "387f2544-bfa8-44ed-9793-a5bd5eaafe57",
|
|
||||||
AccessFailedCount = 0,
|
|
||||||
ConcurrencyStamp = "6fa96ce1-7e47-4f44-bdeb-e13705729bdb",
|
|
||||||
Email = "admin@admin.admin",
|
|
||||||
EmailConfirmed = false,
|
|
||||||
LockoutEnabled = false,
|
|
||||||
PasswordHash = "AQAAAAEAACcQAAAAECdhgDXw9WdaYvos/Ef9zaSiSApNswFCna2iNk8tu8BsvXRVMQWvdPLE1L8sTdgjDQ==",
|
|
||||||
PhoneNumberConfirmed = false,
|
|
||||||
SecurityStamp = "db1ac172-eb3b-4b93-9f31-3f748a1eda84",
|
|
||||||
TwoFactorEnabled = false,
|
|
||||||
UserName = "admin"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("RoleNameIndex")
|
|
||||||
.HasFilter("[NormalizedName] IS NOT NULL");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoles");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = "fb054f77-3578-45ee-a3d6-e6fe706526b2",
|
|
||||||
ConcurrencyStamp = "4af0d06c-63be-448c-a1ee-7c369398dee5",
|
|
||||||
Name = "Admin"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = "d3aa27bb-2866-4a7d-9f0d-30498859ae94",
|
|
||||||
ConcurrencyStamp = "64b281d1-f963-43ae-a25e-1f8f220b553d",
|
|
||||||
Name = "Employee"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoleClaims");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserClaims");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderKey")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderDisplayName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("LoginProvider", "ProviderKey");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserLogins");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "RoleId");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
UserId = "387f2544-bfa8-44ed-9793-a5bd5eaafe57",
|
|
||||||
RoleId = "fb054f77-3578-45ee-a3d6-e6fe706526b2"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
UserId = "387f2544-bfa8-44ed-9793-a5bd5eaafe57",
|
|
||||||
RoleId = "d3aa27bb-2866-4a7d-9f0d-30498859ae94"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "LoginProvider", "Name");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserTokens");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.Rents", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.Car", "Car")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CarId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Data.Entities.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId");
|
|
||||||
|
|
||||||
b.Navigation("Car");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace Data.Migrations
|
|
||||||
{
|
|
||||||
public partial class migrena : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetRoles",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetUsers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
PersonalNumber = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
||||||
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
||||||
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Cars",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
Brand = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Model = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Year = table.Column<int>(type: "int", nullable: false),
|
|
||||||
CountPassengerSeats = table.Column<int>(type: "int", nullable: false),
|
|
||||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
PriceForDay = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Cars", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetRoleClaims",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
|
||||||
column: x => x.RoleId,
|
|
||||||
principalTable: "AspNetRoles",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetUserClaims",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "AspNetUsers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetUserLogins",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "AspNetUsers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetUserRoles",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
|
||||||
column: x => x.RoleId,
|
|
||||||
principalTable: "AspNetRoles",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "AspNetUsers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetUserTokens",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "AspNetUsers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Rents",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
CarId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
UserId = table.Column<string>(type: "nvarchar(450)", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Rents", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Rents_AspNetUsers_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "AspNetUsers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Rents_Cars_CarId",
|
|
||||||
column: x => x.CarId,
|
|
||||||
principalTable: "Cars",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "AspNetRoles",
|
|
||||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
|
||||||
values: new object[] { "fb054f77-3578-45ee-a3d6-e6fe706526b2", "4af0d06c-63be-448c-a1ee-7c369398dee5", "Admin", null });
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "AspNetRoles",
|
|
||||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
|
||||||
values: new object[] { "d3aa27bb-2866-4a7d-9f0d-30498859ae94", "64b281d1-f963-43ae-a25e-1f8f220b553d", "Employee", null });
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "AspNetUsers",
|
|
||||||
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FirstName", "LastName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PersonalNumber", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
|
|
||||||
values: new object[] { "387f2544-bfa8-44ed-9793-a5bd5eaafe57", 0, "6fa96ce1-7e47-4f44-bdeb-e13705729bdb", "admin@admin.admin", false, null, null, false, null, null, null, "AQAAAAEAACcQAAAAECdhgDXw9WdaYvos/Ef9zaSiSApNswFCna2iNk8tu8BsvXRVMQWvdPLE1L8sTdgjDQ==", null, null, false, "db1ac172-eb3b-4b93-9f31-3f748a1eda84", false, "admin" });
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "AspNetUserRoles",
|
|
||||||
columns: new[] { "RoleId", "UserId" },
|
|
||||||
values: new object[] { "fb054f77-3578-45ee-a3d6-e6fe706526b2", "387f2544-bfa8-44ed-9793-a5bd5eaafe57" });
|
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
|
||||||
table: "AspNetUserRoles",
|
|
||||||
columns: new[] { "RoleId", "UserId" },
|
|
||||||
values: new object[] { "d3aa27bb-2866-4a7d-9f0d-30498859ae94", "387f2544-bfa8-44ed-9793-a5bd5eaafe57" });
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetRoleClaims_RoleId",
|
|
||||||
table: "AspNetRoleClaims",
|
|
||||||
column: "RoleId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "RoleNameIndex",
|
|
||||||
table: "AspNetRoles",
|
|
||||||
column: "NormalizedName",
|
|
||||||
unique: true,
|
|
||||||
filter: "[NormalizedName] IS NOT NULL");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetUserClaims_UserId",
|
|
||||||
table: "AspNetUserClaims",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetUserLogins_UserId",
|
|
||||||
table: "AspNetUserLogins",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetUserRoles_RoleId",
|
|
||||||
table: "AspNetUserRoles",
|
|
||||||
column: "RoleId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "EmailIndex",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "NormalizedEmail");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AspNetUsers_PersonalNumber",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "PersonalNumber",
|
|
||||||
unique: true,
|
|
||||||
filter: "[PersonalNumber] IS NOT NULL");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "UserNameIndex",
|
|
||||||
table: "AspNetUsers",
|
|
||||||
column: "NormalizedUserName",
|
|
||||||
unique: true,
|
|
||||||
filter: "[NormalizedUserName] IS NOT NULL");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Rents_CarId",
|
|
||||||
table: "Rents",
|
|
||||||
column: "CarId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Rents_UserId",
|
|
||||||
table: "Rents",
|
|
||||||
column: "UserId");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetRoleClaims");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetUserClaims");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetUserLogins");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetUserRoles");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetUserTokens");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Rents");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetRoles");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AspNetUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Cars");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,403 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
namespace Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(RentACarDbContext))]
|
|
||||||
partial class RentACarDbContextModelSnapshot : ModelSnapshot
|
|
||||||
{
|
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
|
||||||
.HasAnnotation("ProductVersion", "5.0.15")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.Car", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<string>("Brand")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("CountPassengerSeats")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Model")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<decimal>("PriceForDay")
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<int>("Year")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Cars");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.Rents", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<int>("CarId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime>("StartDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CarId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Rents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.User", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("FirstName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("LastName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("datetimeoffset");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PersonalNumber")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
|
||||||
.HasDatabaseName("EmailIndex");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedUserName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("UserNameIndex")
|
|
||||||
.HasFilter("[NormalizedUserName] IS NOT NULL");
|
|
||||||
|
|
||||||
b.HasIndex("PersonalNumber")
|
|
||||||
.IsUnique()
|
|
||||||
.HasFilter("[PersonalNumber] IS NOT NULL");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUsers");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = "387f2544-bfa8-44ed-9793-a5bd5eaafe57",
|
|
||||||
AccessFailedCount = 0,
|
|
||||||
ConcurrencyStamp = "6fa96ce1-7e47-4f44-bdeb-e13705729bdb",
|
|
||||||
Email = "admin@admin.admin",
|
|
||||||
EmailConfirmed = false,
|
|
||||||
LockoutEnabled = false,
|
|
||||||
PasswordHash = "AQAAAAEAACcQAAAAECdhgDXw9WdaYvos/Ef9zaSiSApNswFCna2iNk8tu8BsvXRVMQWvdPLE1L8sTdgjDQ==",
|
|
||||||
PhoneNumberConfirmed = false,
|
|
||||||
SecurityStamp = "db1ac172-eb3b-4b93-9f31-3f748a1eda84",
|
|
||||||
TwoFactorEnabled = false,
|
|
||||||
UserName = "admin"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("RoleNameIndex")
|
|
||||||
.HasFilter("[NormalizedName] IS NOT NULL");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoles");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = "fb054f77-3578-45ee-a3d6-e6fe706526b2",
|
|
||||||
ConcurrencyStamp = "4af0d06c-63be-448c-a1ee-7c369398dee5",
|
|
||||||
Name = "Admin"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = "d3aa27bb-2866-4a7d-9f0d-30498859ae94",
|
|
||||||
ConcurrencyStamp = "64b281d1-f963-43ae-a25e-1f8f220b553d",
|
|
||||||
Name = "Employee"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoleClaims");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserClaims");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderKey")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderDisplayName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("LoginProvider", "ProviderKey");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserLogins");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "RoleId");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
UserId = "387f2544-bfa8-44ed-9793-a5bd5eaafe57",
|
|
||||||
RoleId = "fb054f77-3578-45ee-a3d6-e6fe706526b2"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
UserId = "387f2544-bfa8-44ed-9793-a5bd5eaafe57",
|
|
||||||
RoleId = "d3aa27bb-2866-4a7d-9f0d-30498859ae94"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "LoginProvider", "Name");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserTokens");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Data.Entities.Rents", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.Car", "Car")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CarId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Data.Entities.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId");
|
|
||||||
|
|
||||||
b.Navigation("Car");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Data.Entities.User", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ namespace Data.Entities
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[ForeignKey("Car")]
|
[ForeignKey("Car")]
|
||||||
public int CarId { get; set; }
|
|
||||||
public virtual Car Car { get; set; }
|
public virtual Car Car { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime StartDate { get; set; }
|
public DateTime StartDate { get; set; }
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ namespace WebApp.Controllers
|
|||||||
|
|
||||||
return View(rents);
|
return View(rents);
|
||||||
}
|
}
|
||||||
|
public async Task<IActionResult> DateSelect(DateTime startDate, DateTime endDate)
|
||||||
|
{
|
||||||
|
|
||||||
|
return RedirectToAction(nameof(Index));
|
||||||
|
}
|
||||||
|
|
||||||
// GET: Rents/Create
|
// GET: Rents/Create
|
||||||
public IActionResult Create(int id)
|
public IActionResult Create(int id)
|
||||||
@@ -55,11 +60,11 @@ namespace WebApp.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
|
|
||||||
public async Task<IActionResult> Create([Bind("Id,CarId,StartDate,EndDate,UserId")] Rents rents)
|
public async Task<IActionResult> Create([Bind("Id,Car.Id,StartDate,EndDate,UserId")] Rents rents)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
var car = _context.Cars.FirstOrDefault(car => car.Id == rents.CarId);
|
var car = _context.Cars.FirstOrDefault(car => car.Id == rents.Car.Id);
|
||||||
rents.Car = car;
|
rents.Car = car;
|
||||||
_context.Add(rents);
|
_context.Add(rents);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
@@ -152,5 +157,18 @@ namespace WebApp.Controllers
|
|||||||
{
|
{
|
||||||
return _context.Rents.Any(e => e.Id == id);
|
return _context.Rents.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
|
public bool CarIsAvailable(int carId, DateTime startDate, DateTime endDate)
|
||||||
|
{
|
||||||
|
var rents = _context.Rents.Where(x => x.Car.Id == carId);
|
||||||
|
if (rents != null)
|
||||||
|
{
|
||||||
|
foreach (var item in rents)
|
||||||
|
{
|
||||||
|
return !(item.StartDate < endDate && startDate < item.EndDate);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,18 @@
|
|||||||
ViewData["Title"] = "Cars";
|
ViewData["Title"] = "Cars";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Vehicle</h1>
|
<h1>Vehicles</h1>
|
||||||
<h2>Available cars</h2>
|
|
||||||
<p>
|
<p>
|
||||||
@if (this.User.IsInRole("Admin"))
|
@if (this.User.IsInRole("Admin"))
|
||||||
{
|
{
|
||||||
<a asp-action="Create">Create car</a>
|
<a type="button" class="btn btn-primary" asp-action="Create">Add new car</a>
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Id)
|
ID
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Brand)
|
@Html.DisplayNameFor(model => model.Brand)
|
||||||
@@ -28,16 +27,16 @@
|
|||||||
@Html.DisplayNameFor(model => model.Year)
|
@Html.DisplayNameFor(model => model.Year)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.CountPassengerSeats)
|
Seats
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Description)
|
@Html.DisplayNameFor(model => model.Description)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.PriceForDay)
|
Daily price
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Select
|
Actions
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -66,9 +65,6 @@
|
|||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.PriceForDay)
|
@Html.DisplayFor(modelItem => item.PriceForDay)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<a asp-controller="Rents" asp-action="Create" >Select</a>
|
|
||||||
</td>
|
|
||||||
@if (this.User.IsInRole("Admin"))
|
@if (this.User.IsInRole("Admin"))
|
||||||
{
|
{
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -3,5 +3,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Welcome</h1>
|
<h1 class="display-4">Welcome, @User.Identity.Name</h1>
|
||||||
|
<br />
|
||||||
|
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Cars" asp-action="Index">Manage cars</a>
|
||||||
|
@if (this.User.IsInRole("Admin"))
|
||||||
|
{
|
||||||
|
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Rents" asp-action="Index">Manage rents</a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Privacy Policy";
|
|
||||||
}
|
|
||||||
<h1>@ViewData["Title"]</h1>
|
|
||||||
|
|
||||||
<p>Use this page to detail your site's privacy policy.</p>
|
|
||||||
@@ -4,19 +4,17 @@
|
|||||||
ViewData["Title"] = "Create";
|
ViewData["Title"] = "Create";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Create</h1>
|
<h1>Create rent</h1>
|
||||||
|
|
||||||
<h4>Rents</h4>
|
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form asp-action="Create">
|
<form asp-action="Create">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="CarId" class="control-label"></label>
|
<label asp-for="Car.Id" class="control-label"></label>
|
||||||
<input asp-for="CarId" class="form-control" />
|
<input asp-for="Car.Id" class="form-control" />
|
||||||
<span asp-validation-for="CarId" class="text-danger"></span>
|
<span asp-validation-for="Car.Id" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="StartDate" class="control-label"></label>
|
<label asp-for="StartDate" class="control-label"></label>
|
||||||
<input asp-for="StartDate" class="form-control" />
|
<input asp-for="StartDate" class="form-control" />
|
||||||
@@ -38,6 +36,8 @@
|
|||||||
<a asp-action="Index">Back to List</a>
|
<a asp-action="Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||||
}
|
}
|
||||||
|
|||||||
34
RentACar/WebApp/Views/Rents/DateSelect.cshtml
Normal file
34
RentACar/WebApp/Views/Rents/DateSelect.cshtml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
@model Data.Entities.Rents
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "DateSelect";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Rent a car</h1>
|
||||||
|
<h2>Select dates</h2>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<form asp-action="Create">
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="StartDate" class="control-label"></label>
|
||||||
|
<input asp-for="StartDate" class="form-control" />
|
||||||
|
<span asp-validation-for="StartDate" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="EndDate" class="control-label"></label>
|
||||||
|
<input asp-for="EndDate" class="form-control" />
|
||||||
|
<span asp-validation-for="EndDate" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" value="Findiew" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||||
|
}
|
||||||
@@ -4,30 +4,53 @@
|
|||||||
ViewData["Title"] = "Delete";
|
ViewData["Title"] = "Delete";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Delete</h1>
|
<h1>Delete rent</h1>
|
||||||
|
|
||||||
<h3>Are you sure you want to delete this?</h3>
|
<h3>Are you sure you want to delete this?</h3>
|
||||||
<div>
|
<div>
|
||||||
<h4>Rents</h4>
|
|
||||||
<hr />
|
<hr />
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Car.Id)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Car.Id)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Car.Brand)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Car.Brand)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Car.Model)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Car.Model)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Car.PriceForDay)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Car.PriceForDay)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.StartDate)
|
@Html.DisplayNameFor(model => model.StartDate)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.StartDate)
|
@Html.DisplayFor(model => model.StartDate)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.EndDate)
|
@Html.DisplayNameFor(model => model.EndDate)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.EndDate)
|
@Html.DisplayFor(model => model.EndDate)
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form asp-action="Delete">
|
<form asp-action="Delete">
|
||||||
<input type="hidden" asp-for="Id" />
|
<input type="hidden" asp-for="Id" />
|
||||||
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||||
<a asp-action="Index">Back to List</a>
|
<a class="btn btn-secondary" asp-action="Index">Back to List</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<h1>Details</h1>
|
<h1>Details</h1>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h4>Rents</h4>
|
|
||||||
<hr />
|
<hr />
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class = "col-sm-2">
|
<dt class = "col-sm-2">
|
||||||
@@ -25,6 +24,6 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
<a class="btn btn-primary" asp-action="Edit" asp-route-id="@Model.Id">Edit</a>
|
||||||
<a asp-action="Index">Back to List</a>
|
<a class="btn btn-secondary" asp-action="Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,15 +4,18 @@
|
|||||||
ViewData["Title"] = "Edit";
|
ViewData["Title"] = "Edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Edit</h1>
|
<h1>Edit rent</h1>
|
||||||
|
|
||||||
<h4>Rents</h4>
|
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form asp-action="Edit">
|
<form asp-action="Edit">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="Id" />
|
<input type="hidden" asp-for="Id" />
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Car.Id" class="control-label"></label>
|
||||||
|
<input asp-for="Car.Id" class="form-control" />
|
||||||
|
<span asp-validation-for="Car.Id" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="StartDate" class="control-label"></label>
|
<label asp-for="StartDate" class="control-label"></label>
|
||||||
<input asp-for="StartDate" class="form-control" />
|
<input asp-for="StartDate" class="form-control" />
|
||||||
@@ -24,15 +27,13 @@
|
|||||||
<span asp-validation-for="EndDate" class="text-danger"></span>
|
<span asp-validation-for="EndDate" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="submit" value="Save" class="btn btn-primary" />
|
<input class="btn btn-primary" type="submit" value="Save" />
|
||||||
|
<a class="btn btn-secondary" asp-action="Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<a asp-action="Index">Back to List</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||||
|
|||||||
@@ -7,44 +7,53 @@
|
|||||||
<h1>Rents</h1>
|
<h1>Rents</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create">Create New</a>
|
<a type="button" class="btn btn-primary" asp-action="Create">Rent a car</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
@if (this.User.IsInRole("Admin"))
|
||||||
<thead>
|
{
|
||||||
<tr>
|
<table class="table">
|
||||||
<th>
|
<thead>
|
||||||
@Html.DisplayNameFor(model => model.CarId)
|
<tr>
|
||||||
</th>
|
<th>
|
||||||
<th>
|
Car ID
|
||||||
@Html.DisplayNameFor(model => model.StartDate)
|
</th>
|
||||||
</th>
|
<th>
|
||||||
<th>
|
Start Date
|
||||||
@Html.DisplayNameFor(model => model.EndDate)
|
</th>
|
||||||
</th>
|
<th>
|
||||||
<th></th>
|
End Date
|
||||||
</tr>
|
</th>
|
||||||
</thead>
|
@if (this.User.IsInRole("Admin"))
|
||||||
<tbody>
|
{
|
||||||
@foreach (var item in Model) {
|
<th>
|
||||||
<tr>
|
Actions
|
||||||
<td>
|
</th>
|
||||||
@Html.DisplayFor(modelItem => item.CarId)
|
}
|
||||||
</td>
|
</tr>
|
||||||
<td>
|
</thead>
|
||||||
@Html.DisplayFor(modelItem => item.StartDate)
|
<tbody>
|
||||||
</td>
|
@foreach (var item in Model)
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.EndDate)
|
|
||||||
</td>
|
|
||||||
@if (this.User.IsInRole("Admin"))
|
|
||||||
{
|
{
|
||||||
<td>
|
<tr>
|
||||||
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
<td>
|
||||||
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
@Html.DisplayFor(modelItem => item.Car.Id)
|
||||||
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.StartDate)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.EndDate)
|
||||||
|
</td>
|
||||||
|
@if (this.User.IsInRole("Admin"))
|
||||||
|
{
|
||||||
|
<td>
|
||||||
|
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||||
|
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
||||||
|
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
}
|
}
|
||||||
</tr>
|
</tbody>
|
||||||
}
|
</table>
|
||||||
</tbody>
|
}
|
||||||
</table>
|
|
||||||
@@ -27,12 +27,6 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Rents" asp-action="Index">Rents</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Rents" asp-action="Index">Rents</a>
|
||||||
</li>
|
</li>
|
||||||
@if (this.User.IsInRole("Admin"))
|
|
||||||
{
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Users" asp-action="Index">Users</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</ul>
|
</ul>
|
||||||
<partial name="_LoginPartial" />
|
<partial name="_LoginPartial" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
@if (SignInManager.IsSignedIn(User))
|
@if (SignInManager.IsSignedIn(User))
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello, @User.Identity.Name</a>
|
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Account</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
|
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
|
||||||
|
|||||||
Reference in New Issue
Block a user