no comment

This commit is contained in:
2017-10-04 23:53:47 +02:00
parent 9164a6cece
commit a9035f0cbb
54 changed files with 6158 additions and 213 deletions

View File

@ -4,6 +4,7 @@ namespace Yavsc.Models.Access
using Models.Relationship;
using Newtonsoft.Json;
using Yavsc;
using Blog;
public class CircleAuthorizationToBlogPost : ICircleAuthorization
{
@ -12,7 +13,7 @@ namespace Yavsc.Models.Access
[JsonIgnore]
[ForeignKey("BlogPostId")]
public virtual Blog Target { get; set; }
public virtual BlogPost Target { get; set; }
[JsonIgnore]
[ForeignKey("CircleId")]

View File

@ -32,6 +32,7 @@ namespace Yavsc.Models
using Bank;
using Payment;
using Yavsc.Models.Calendar;
using Blog;
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
@ -82,7 +83,7 @@ namespace Yavsc.Models
/// Users posts
/// </summary>
/// <returns></returns>
public DbSet<Blog> Blogspot { get; set; }
public DbSet<Blog.BlogPost> Blogspot { get; set; }
/// <summary>
/// Skills propulsed by this site
@ -289,5 +290,7 @@ namespace Yavsc.Models
public DbSet<Feature> Feature { get; set; }
public DbSet<Bug> Bug { get; set; }
public DbSet<Comment> Comment { get; set; }
}
}

View File

@ -8,29 +8,33 @@ using Yavsc.Interfaces;
using Yavsc.Models.Access;
using Yavsc.Models.Relationship;
namespace Yavsc.Models
namespace Yavsc.Models.Blog
{
public partial class Blog : IBlog, ICircleAuthorized, ITaggable<long>, IIdentified<long>
public class BlogPost : IBlogPost, ICircleAuthorized, ITaggable<long>, IIdentified<long>
{
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Display(Name="Identifiant du post")]
public long Id { get; set; }
[Display(Name="Contenu")]
[Display(Name="Contenu")][StringLength(56224)]
public string Content { get; set; }
[Display(Name="Photo")]
[Display(Name="Photo")][StringLength(1024)]
public string Photo { get; set; }
[Display(Name="Indice de qualité")]
public int Rate { get; set; }
[Display(Name="Titre")]
[Display(Name="Titre")][StringLength(1024)]
public string Title { get; set; }
[Display(Name="Identifiant de l'auteur")]
public string AuthorId { get; set; }
[Display(Name="Auteur")]
[ForeignKey("AuthorId"),JsonIgnore]
public ApplicationUser Author { set; get; }
[Display(Name="Visible")]
public bool Visible { get; set; }
@ -66,7 +70,7 @@ namespace Yavsc.Models
{
return ACL?.Any( i=>i.CircleId == circleId) ?? true;
}
public string GetOwnerId()
{
return AuthorId;
@ -94,7 +98,10 @@ namespace Yavsc.Models
return Tags.Select(t=>t.Tag.Name).ToArray();
}
[JsonIgnore][InverseProperty("Post")]
[InverseProperty("Post")]
public virtual List<BlogTag> Tags { get; set; }
[InverseProperty("Post")]
public virtual List<Comment> Comments { get; set; }
}
}

View File

@ -1,11 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Relationship;
namespace Yavsc.Models.Relationship
namespace Yavsc.Models.Blog
{
public partial class BlogTag
{
[ForeignKey("PostId")]
public virtual Blog Post { get; set; }
public virtual BlogPost Post { get; set; }
public long PostId { get; set; }
[ForeignKey("TagId")]

View File

@ -0,0 +1,60 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Yavsc.Attributes.Validation;
using Yavsc.Interfaces;
namespace Yavsc.Models.Blog
{
public partial class Comment : IComment<long>, IBaseTrackedEntity
{
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[YaStringLength(1024)]
public string Content { get; set; }
[ForeignKeyAttribute("PostId")][JsonIgnore]
public virtual BlogPost Post { get; set; }
[Required]
public long PostId { get; set; }
public bool Visible { get; set; }
[ForeignKeyAttribute("UserCreated")][JsonIgnore]
public virtual ApplicationUser Author {
get; set;
}
[Required]
public string UserCreated
{
get; set;
}
public DateTime DateModified
{
get; set;
}
public string UserModified
{
get; set;
}
public DateTime DateCreated
{
get; set;
}
public long GetReceiverId()
{
return PostId;
}
public void SetReceiverId(long rid)
{
PostId = rid;
}
}
}

View File

@ -1,16 +0,0 @@
using System;
namespace Yavsc.Models
{
public partial class comment
{
public long _id { get; set; }
public string applicationname { get; set; }
public string bcontent { get; set; }
public DateTime modified { get; set; }
public DateTime posted { get; set; }
public long? postid { get; set; }
public string username { get; set; }
public bool visible { get; set; }
}
}

View File

@ -12,7 +12,7 @@ namespace Yavsc.Models
using Models.Bank;
using Models.Access;
using Newtonsoft.Json;
public class ApplicationUser : IdentityUser
{
/// <summary>
@ -43,7 +43,7 @@ namespace Yavsc.Models
/// </summary>
/// <returns></returns>
[InverseProperty("Author"),JsonIgnore]
public virtual List<Blog> Posts { get; set; }
public virtual List<Blog.BlogPost> Posts { get; set; }
/// <summary>
/// User's contact list