Editor povezava na db
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using ZpcBulletinBoard.Classes;
|
||||
|
||||
namespace ZpcBulletinBoard.Models.Editor
|
||||
{
|
||||
@@ -29,9 +30,11 @@ namespace ZpcBulletinBoard.Models.Editor
|
||||
[Display(Name = "Razmerje")]
|
||||
public RatioEnum Ratio { get; set; }
|
||||
|
||||
[NotMapped] public string RatioString => Ratio.GetAttributeOfType<DisplayAttribute>().Name ?? "";
|
||||
|
||||
|
||||
// InvoicePart
|
||||
[InverseProperty("BulletinBoard")]
|
||||
public virtual ICollection<Note> Notes { get; set; }
|
||||
public virtual ICollection<BulletinBoardPage> Pages { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
31
ZpcBulletinBoard/Models/Editor/BulletinBoardPage.cs
Normal file
31
ZpcBulletinBoard/Models/Editor/BulletinBoardPage.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ZpcBulletinBoard.Models.Editor
|
||||
{
|
||||
public class BulletinBoardPage
|
||||
{
|
||||
|
||||
[Key]
|
||||
public int IdBulletinBoardPage { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey("BulletinBoard")]
|
||||
public int IdBulletinBoard { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Ime")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Trajanje")]
|
||||
public int Duration { get; set; }
|
||||
|
||||
// ForeignKey
|
||||
public BulletinBoard BulletinBoard { get; set; }
|
||||
|
||||
|
||||
[InverseProperty("BulletinBoardPage")]
|
||||
public virtual ICollection<Note> Notes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ namespace ZpcBulletinBoard.Models.Editor
|
||||
public int IdNote { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey("BulletinBoard")]
|
||||
public int IdBulletinBoard { get; set; }
|
||||
[ForeignKey("BulletinBoardPage")]
|
||||
public int IdBulletinBoardPage { get; set; }
|
||||
|
||||
[Required]
|
||||
public int X { get; set; }
|
||||
@@ -31,6 +31,6 @@ namespace ZpcBulletinBoard.Models.Editor
|
||||
public string Content { get; set; }
|
||||
|
||||
// ForeignKey
|
||||
public BulletinBoard BulletinBoard{ get; set; }
|
||||
public BulletinBoardPage BulletinBoardPage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user