ForeignKey
This commit is contained in:
parent
e2dd3b3b4f
commit
3b332d1fe9
@ -18,7 +18,7 @@ namespace ElectronicsShopDataBaseImplement.Models
|
||||
public int ID { get; set; }
|
||||
[Required]
|
||||
public double Sum { get; set; }
|
||||
[Required]
|
||||
[ForeignKey("UserID")]
|
||||
public int UserID { get; set; }
|
||||
[Required]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -11,10 +12,10 @@ namespace ElectronicsShopDataBaseImplement.Models
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey("OrderID")]
|
||||
public int OrdersID { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey("ProductID")]
|
||||
public int ProductID { get; set; }
|
||||
|
||||
[Required]
|
||||
|
@ -4,6 +4,7 @@ using ElectronicsShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -17,7 +18,7 @@ namespace ElectronicsShopDataBaseImplement.Models
|
||||
public string ProductName { get; set; }=string.Empty;
|
||||
[Required]
|
||||
public double Price { get; set; }
|
||||
[Required]
|
||||
[ForeignKey("CategoryID")]
|
||||
public int CategoryID { get; set; }
|
||||
|
||||
public static Product? Create(ProductBindingModel? model)
|
||||
|
@ -4,6 +4,7 @@ using ElectronicsShopDataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -25,7 +26,7 @@ namespace ElectronicsShopDataBaseImplement.Models
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[Required]
|
||||
[ForeignKey("RoleID")]
|
||||
public int RoleID { get; set; }
|
||||
|
||||
public static User? Create(UserBindingModel model)
|
||||
|
Loading…
Reference in New Issue
Block a user