UsersController

This commit is contained in:
ani_konarcheva@abv.bg
2022-04-07 23:52:54 +03:00
parent 7a352c35f6
commit 4e25e34b99
14 changed files with 784 additions and 20 deletions

View File

@@ -20,7 +20,7 @@ namespace Data
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlServer("Server=.;Database=RentACar;Integrated Security=true;");
optionsBuilder.UseSqlServer("Server=.\\SQLEXPRESS;Database=RentACar;Integrated Security=true;");
}
}

View File

@@ -9,6 +9,7 @@ namespace Data.Entities
{
public class Car
{
[Required]
public int Id { get; set; }
[Required]

View File

@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
@@ -11,10 +12,13 @@ namespace Data.Entities
public class Rents
{
public int Id { get; set; }
[Required]
[ForeignKey("Car")]
public int CarId { get; set; }
public virtual Car Car { get; set; }
[Required]
public DateTime StartDate { get; set; }
[Required]
public DateTime EndDate { get; set; }
[ForeignKey("User")]
public string UserId { get; set; }