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