refabrique

This commit is contained in:
2016-08-02 17:02:38 +02:00
parent 12fd7c3f3d
commit b565cf54e5
17 changed files with 1797 additions and 139 deletions

View File

@ -44,7 +44,7 @@ namespace Yavsc.Controllers
return UserPosts(id);
return View(_context.Blogspot.Include(
b => b.Author
).Where(p => p.visible));
).Where(p => p.Visible));
}
[Route("/Title/{id?}")]
@ -53,7 +53,7 @@ namespace Yavsc.Controllers
{
return View("Index", _context.Blogspot.Include(
b => b.Author
).Where(x => x.title == id).ToList());
).Where(x => x.Title == id).ToList());
}
[Route("/Blog/{id?}")]
@ -63,14 +63,14 @@ namespace Yavsc.Controllers
if (string.IsNullOrEmpty(id))
return View("Index",_context.Blogspot.Include(
b => b.Author
).Where(p => p.visible));
).Where(p => p.Visible));
if (User.IsSignedIn())
return View("Index", _context.Blogspot.Include(
b => b.Author
).Where(x => x.Author.UserName == id).ToList());
return View("Index", _context.Blogspot.Include(
b => b.Author
).Where(x => x.Author.UserName == id && x.visible).ToList());
).Where(x => x.Author.UserName == id && x.Visible).ToList());
}
// GET: Blog/Details/5
[AllowAnonymous]
@ -103,14 +103,14 @@ namespace Yavsc.Controllers
[HttpPost, Authorize(), ValidateAntiForgeryToken]
public IActionResult Create(Blog blog)
{
blog.modified = blog.posted = DateTime.Now;
blog.rate = 0;
blog.Modified = blog.Posted = DateTime.Now;
blog.Rate = 0;
blog.AuthorId = User.GetUserId();
_logger.LogWarning($"Post from: {blog.AuthorId}");
ModelState.ClearValidationState("AuthorId");
if (ModelState.IsValid)
{
blog.posted = DateTime.Now;
blog.Posted = DateTime.Now;
_context.Blogspot.Add(blog);
_context.SaveChanges();
return RedirectToAction("Index");
@ -152,7 +152,7 @@ namespace Yavsc.Controllers
var auth = _authorizationService.AuthorizeAsync(User, blog, new EditRequirement());
if (auth.Result)
{
blog.modified = DateTime.Now;
blog.Modified = DateTime.Now;
_context.Update(blog);
_context.SaveChanges();
ViewData["StatusMessage"] = "Post modified";

View File

@ -31,8 +31,8 @@ namespace Yavsc.Controllers
public ActionResult Index()
{
var latestPosts = _context.Blogspot.Where(
x => x.visible == true
).OrderBy(x => x.modified).Take(25).ToArray();
x => x.Visible == true
).OrderBy(x => x.Modified).Take(25).ToArray();
return View(latestPosts);
}

View File

@ -0,0 +1,672 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160802143258_bcontentornot")]
partial class bcontentornot
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("Yavsc.Models.Auth.Client", b =>
{
b.Property<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{
b.Property<string>("SIREN");
b.HasKey("SIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId");
b.Property<string>("Content");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.Property<string>("DeviceId");
b.Property<DateTime>("DeclarationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<string>("DeviceOwnerId");
b.Property<string>("GCMRegistrationId")
.IsRequired();
b.Property<string>("Model");
b.Property<string>("Platform");
b.Property<string>("Version");
b.HasKey("DeviceId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerformerId");
b.Property<bool>("AcceptGeoLocalization");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganizationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerformerId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithOne()
.HasForeignKey("Yavsc.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.HasOne("Yavsc.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.HasOne("Yavsc.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Market.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("OrganizationAddressId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
}
}
}

View File

@ -0,0 +1,17 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class bcontentornot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(name: "bcontent", table: "Blog", newName:"Content");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(name: "Content", table: "Blog", newName:"bcontent");
}
}
}

View File

@ -0,0 +1,672 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160802145351_camelCaseBlog")]
partial class camelCaseBlog
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("Yavsc.Models.Auth.Client", b =>
{
b.Property<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{
b.Property<string>("SIREN");
b.HasKey("SIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId");
b.Property<string>("Content");
b.Property<DateTime>("Modified");
b.Property<string>("Photo");
b.Property<DateTime>("Posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("Rate");
b.Property<string>("Title");
b.Property<bool>("Visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.Property<string>("DeviceId");
b.Property<DateTime>("DeclarationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<string>("DeviceOwnerId");
b.Property<string>("GCMRegistrationId")
.IsRequired();
b.Property<string>("Model");
b.Property<string>("Platform");
b.Property<string>("Version");
b.HasKey("DeviceId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerformerId");
b.Property<bool>("AcceptGeoLocalization");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganizationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerformerId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithOne()
.HasForeignKey("Yavsc.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.HasOne("Yavsc.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.HasOne("Yavsc.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Market.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("OrganizationAddressId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
}
}
}

View File

@ -0,0 +1,305 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class camelCaseBlog : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.RenameColumn(
name: "visible",
table: "Blog",
newName: "Visible");
migrationBuilder.RenameColumn(
name: "title",
table: "Blog",
newName: "Title");
migrationBuilder.RenameColumn(
name: "rate",
table: "Blog",
newName: "Rate");
migrationBuilder.RenameColumn(
name: "posted",
table: "Blog",
newName: "Posted");
migrationBuilder.RenameColumn(
name: "photo",
table: "Blog",
newName: "Photo");
migrationBuilder.RenameColumn(
name: "modified",
table: "Blog",
newName: "Modified");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.RenameColumn(
name: "Visible",
table: "Blog",
newName: "visible");
migrationBuilder.RenameColumn(
name: "Title",
table: "Blog",
newName: "title");
migrationBuilder.RenameColumn(
name: "Rate",
table: "Blog",
newName: "rate");
migrationBuilder.RenameColumn(
name: "Posted",
table: "Blog",
newName: "posted");
migrationBuilder.RenameColumn(
name: "Photo",
table: "Blog",
newName: "photo");
migrationBuilder.RenameColumn(
name: "Modified",
table: "Blog",
newName: "modified");
}
}
}

View File

@ -1,6 +1,8 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
@ -309,21 +311,21 @@ namespace Yavsc.Migrations
b.Property<string>("AuthorId");
b.Property<string>("bcontent");
b.Property<string>("Content");
b.Property<DateTime>("modified");
b.Property<DateTime>("Modified");
b.Property<string>("photo");
b.Property<string>("Photo");
b.Property<DateTime>("posted")
b.Property<DateTime>("Posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("rate");
b.Property<int>("Rate");
b.Property<string>("title");
b.Property<string>("Title");
b.Property<bool>("visible");
b.Property<bool>("Visible");
b.HasKey("Id");
});

View File

@ -25,7 +25,7 @@ namespace Yavsc.Models
// Add your customizations after calling base.OnModelCreating(builder);
builder.Entity<Contact>().HasKey(x => new { x.OwnerId, x.UserId });
builder.Entity<BookQuery>().Property(x=>x.CreationDate).HasDefaultValueSql("LOCALTIMESTAMP");
builder.Entity<Blog>().Property(x=>x.posted).HasDefaultValueSql("LOCALTIMESTAMP");
builder.Entity<Blog>().Property(x=>x.Posted).HasDefaultValueSql("LOCALTIMESTAMP");
builder.Entity<GoogleCloudMobileDeclaration>().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
}

View File

@ -9,23 +9,15 @@ namespace Yavsc.Models
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[Display(Name="Content")]
public string bcontent { get; set; }
[Display(Name="Modified")]
public DateTime modified { get; set; }
[Display(Name="Photo")]
public string photo { get; set; }
[Display(Name="Posted")]
public DateTime posted { get; set; }
[Display(Name="Rate")]
public int rate { get; set; }
[Display(Name="Title")]
public string title { get; set; }
public string Content { get; set; }
public DateTime Modified { get; set; }
public string Photo { get; set; }
public DateTime Posted { get; set; }
public int Rate { get; set; }
public string Title { get; set; }
public string AuthorId { get; set; }
[ForeignKey("AuthorId")]
public ApplicationUser Author { set; get; }
[Display(Name="Visible")]
public bool visible { get; set; }
public bool Visible { get; set; }
}
}

View File

@ -72,7 +72,7 @@ public class BlogViewHandler : AuthorizationHandler<ViewRequirement, Blog>
else if (context.User.Identity.IsAuthenticated)
if (resource.AuthorId == context.User.GetUserId())
context.Succeed(requirement);
else if (resource.visible)
else if (resource.Visible)
// TODO && ( resource.Circles == null || context.User belongs to resource.Circles )
context.Succeed(requirement);
}

View File

@ -13,31 +13,31 @@
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
<div class="form-group">
<label asp-for="title" class="col-md-2 control-label"></label>
<label asp-for="Title" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="title" class="form-control" />
<span asp-validation-for="title" class="text-danger" ></span>
<input asp-for="Title" class="form-control" />
<span asp-validation-for="Title" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
<label asp-for="photo" class="col-md-2 control-label"></label>
<label asp-for="Photo" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="photo" class="form-control" />
<span asp-validation-for="photo" class="text-danger" ></span>
<input asp-for="Photo" class="form-control" />
<span asp-validation-for="Photo" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
<label asp-for="bcontent" class="col-md-2 control-label"></label>
<label asp-for="Content" class="col-md-2 control-label"></label>
<div class="col-md-10">
<textarea asp-for="bcontent" class="form-control" >
<textarea asp-for="Content" class="form-control" >
</textarea>
<span asp-validation-for="bcontent" class="text-danger" ></span>
<span asp-validation-for="Content" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
<label asp-for="visible" class="col-md-2 control-label"></label>
<label asp-for="Visible" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="visible" class="form-control"/>
<input asp-for="Visible" class="form-control"/>
</div>
</div>
<div class="form-group">

View File

@ -1,13 +1,10 @@
@model Yavsc.Models.Blog
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Delete</title>
</head>
<body>
@{
ViewData["Title"] = "Delete";
}
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
<h3>Are you sure you want to delete this?</h3>
<div>
@ -21,46 +18,46 @@
@Model.Author
</dd>
<dt>
@Html.DisplayNameFor(model => model.bcontent)
@Html.DisplayNameFor(model => model.Content)
</dt>
<dd>
@Html.DisplayFor(model => model.bcontent)
@Html.DisplayFor(model => model.Content)
</dd>
<dt>
@Html.DisplayNameFor(model => model.modified)
@Html.DisplayNameFor(model => model.Modified)
</dt>
<dd>
@Html.DisplayFor(model => model.modified)
@Html.DisplayFor(model => model.Modified)
</dd>
<dt>
@Html.DisplayNameFor(model => model.photo)
@Html.DisplayNameFor(model => model.Photo)
</dt>
<dd>
@Html.DisplayFor(model => model.photo)
@Html.DisplayFor(model => model.Photo)
</dd>
<dt>
@Html.DisplayNameFor(model => model.posted)
@Html.DisplayNameFor(model => model.Posted)
</dt>
<dd>
@Html.DisplayFor(model => model.posted)
@Html.DisplayFor(model => model.Posted)
</dd>
<dt>
@Html.DisplayNameFor(model => model.rate)
@Html.DisplayNameFor(model => model.Rate)
</dt>
<dd>
@Html.DisplayFor(model => model.rate)
@Html.DisplayFor(model => model.Rate)
</dd>
<dt>
@Html.DisplayNameFor(model => model.title)
@Html.DisplayNameFor(model => model.Title)
</dt>
<dd>
@Html.DisplayFor(model => model.title)
@Html.DisplayFor(model => model.Title)
</dd>
<dt>
@Html.DisplayNameFor(model => model.visible)
@Html.DisplayNameFor(model => model.Visible)
</dt>
<dd>
@Html.DisplayFor(model => model.visible)
@Html.DisplayFor(model => model.Visible)
</dd>
</dl>
@ -70,9 +67,4 @@
<a asp-action="Index">Back to List</a>
</div>
</form>
</div>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
</body>
</html>
</div>

View File

@ -9,16 +9,16 @@
<hr />
<dl class="dl-horizontal">
<dt>
@SR[Html.DisplayNameFor(model => model.title)]
@SR[Html.DisplayNameFor(model => model.Title)]
</dt>
<dd>
@Html.DisplayFor(model => model.title)
@Html.DisplayFor(model => model.Title)
</dd>
<dt>
@SR[Html.DisplayNameFor(model => model.photo)]
@SR[Html.DisplayNameFor(model => model.Photo)]
</dt>
<dd>
@Html.DisplayFor(model => model.photo)
@Html.DisplayFor(model => model.Photo)
</dd>
<dt>
@SR["Author"]
@ -30,34 +30,34 @@
@SR["Content"]
</dt>
<dd>
<div markdown="@Model.bcontent" base="~/@Model.Id"
<div markdown="@Model.Content" base="~/@Model.Id"
site="SiteSettings.Value"></div>
</dd>
<dt>
@SR[Html.DisplayNameFor(model => model.modified)]
@SR[Html.DisplayNameFor(model => model.Modified)]
</dt>
<dd>
@Html.DisplayFor(model => model.modified)
@Html.DisplayFor(model => model.Modified)
</dd>
<dt>
@SR[Html.DisplayNameFor(model => model.posted)]
@SR[Html.DisplayNameFor(model => model.Posted)]
</dt>
<dd>
@Html.DisplayFor(model => model.posted)
@Html.DisplayFor(model => model.Posted)
</dd>
<dt>
@SR[Html.DisplayNameFor(model => model.rate)]
@SR[Html.DisplayNameFor(model => model.Rate)]
</dt>
<dd>
@Html.DisplayFor(model => model.rate)
@Html.DisplayFor(model => model.Rate)
</dd>
<dt>
@SR[Html.DisplayNameFor(model => model.visible)]
@SR[Html.DisplayNameFor(model => model.Visible)]
</dt>
<dd>
@Html.DisplayFor(model => model.visible)
@Html.DisplayFor(model => model.Visible)
</dd>
</dl>
</div>

View File

@ -44,8 +44,8 @@
<script>
$(document).ready(function() {
var editortitre = new Quill('#titlecnt', {
modules: { toolbar: '#titletoolbar' },
var editortitre = new Quill('#Titlecnt', {
modules: { toolbar: '#Titletoolbar' },
theme: 'snow'
});
var editorcontenu = new Quill('#contentcnt', {
@ -55,31 +55,31 @@
editortitre.on('selection-change', function(range) {
if (range) {
$('#contentbar').addClass('hidden');
$('#titletoolbar').removeClass('hidden');
$('#Titletoolbar').removeClass('hidden');
}
});
editortitre.on('text-change',function(delta,source){
if (source=='user')
{
updateMD('title',$('#titlecnt').html())
updateMD('Title',$('#Titlecnt').html())
}
});
editorcontenu.on('selection-change', function(range) {
if (range) {
$('#contentbar').removeClass('hidden');
$('#titletoolbar').addClass('hidden');
$('#Titletoolbar').addClass('hidden');
}
});
editorcontenu.on('text-change',function(delta,source){
if (source=='user')
{
updateMD('bcontent',$('#contentcnt').html())
updateMD('Content',$('#contentcnt').html())
}
});
$('#contentcnt').focus(function(){
$('#contentbar').removeClass('hidden');
$('#titletoolbar').addClass('hidden');
$('#Titletoolbar').addClass('hidden');
})
Dropzone.options.postfiles= {
@ -100,13 +100,13 @@ editorcontenu.on('text-change',function(delta,source){
}
<h2 > @SR["Blog post edition"] </h2>
<div id="titletoolbar" class="hidden ql-snow ql-toolbar">
<div id="Titletoolbar" class="hidden ql-snow ql-toolbar">
<button class="ql-format-button ql-bold"></button>
<button class="ql-format-button ql-italic"></button>
<button class="ql-format-button ql-strike"></button>
</div>
<h2 id="titlecnt"><markdown>@Model.title</markdown></h2>
<h2 id="Titlecnt"><markdown>@Model.Title</markdown></h2>
<div id="contentbar" class="hidden ql-snow ql-toolbar">
<button class="ql-format-button ql-bold"></button>
@ -132,7 +132,7 @@ editorcontenu.on('text-change',function(delta,source){
</span>
</div>
<div markdown="@Model.bcontent" base="~/@Model.Id" site="SiteSettings.Value" id="contentcnt" ></div>
<div markdown="@Model.Content" base="~/@Model.Id" site="SiteSettings.Value" id="contentcnt" ></div>
<hr>
@ -146,10 +146,10 @@ editorcontenu.on('text-change',function(delta,source){
<input type="hidden" asp-for="Id" />
<input type="hidden" asp-for="AuthorId" />
<div class="form-group">
<label asp-for="title" class="col-md-2 control-label"></label>
<label asp-for="Title" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="title" class="form-control" />
<span asp-validation-for="title" class="text-danger" />
<input asp-for="Title" class="form-control" />
<span asp-validation-for="Title" class="text-danger" />
</div>
</div>
<div class="form-group">
@ -160,17 +160,17 @@ editorcontenu.on('text-change',function(delta,source){
</div>
</div>
<div class="form-group">
<label asp-for="bcontent" class="col-md-2 control-label"></label>
<label asp-for="Content" class="col-md-2 control-label"></label>
<div class="col-md-10">
<textarea asp-for="bcontent" class="form-control" >
<textarea asp-for="Content" class="form-control" >
</textarea>
<span asp-validation-for="bcontent" class="text-danger" />
<span asp-validation-for="Content" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="visible" class="col-md-2 control-label"></label>
<label asp-for="Visible" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="visible" class="form-control"/>
<input asp-for="Visible" class="form-control"/>
</div>
</div>

View File

@ -12,7 +12,7 @@
<table class="table">
<tr>
<th>
@SR[Html.DisplayNameFor(model => model.title)]
@SR[Html.DisplayNameFor(model => model.Title)]
</th>
<th>
@SR["Author"]
@ -26,18 +26,18 @@
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.photo)
<markdown>@item.title</markdown>
@Html.DisplayFor(modelItem => item.Photo)
<markdown>@item.Title</markdown>
</td>
<td>
@item.Author.UserName
</td>
<td>
<span style="font-size:x-small;">
posté le @item.posted.ToString("dddd d MMM yyyy à H:mm")
@if ((item.modified - item.posted).Minutes > 10)
posté le @item.Posted.ToString("dddd d MMM yyyy à H:mm")
@if ((item.Modified - item.Posted).Minutes > 10)
{ 
@:- Modifié le @item.modified.ToString("dddd d MMM yyyy à H:mm")
@:- Modifié le @item.Modified.ToString("dddd d MMM yyyy à H:mm")
}
</span>
</td>

View File

@ -14,25 +14,25 @@
@SR["Author"]
</th>
<th>
@Html.DisplayNameFor(model => model.bcontent)
@Html.DisplayNameFor(model => model.Content)
</th>
<th>
@Html.DisplayNameFor(model => model.modified)
@Html.DisplayNameFor(model => model.Modified)
</th>
<th>
@Html.DisplayNameFor(model => model.photo)
@Html.DisplayNameFor(model => model.Photo)
</th>
<th>
@Html.DisplayNameFor(model => model.posted)
@Html.DisplayNameFor(model => model.Posted)
</th>
<th>
@Html.DisplayNameFor(model => model.rate)
@Html.DisplayNameFor(model => model.Rate)
</th>
<th>
@Html.DisplayNameFor(model => model.title)
@Html.DisplayNameFor(model => model.Title)
</th>
<th>
@Html.DisplayNameFor(model => model.visible)
@Html.DisplayNameFor(model => model.Visible)
</th>
<th></th>
</tr>
@ -43,25 +43,25 @@
@item.Author?.UserName
</td>
<td>
<div md-content="@item.bcontent"/>@item.bcontent
<div md-content="@item.Content"/>@item.Content
</td>
<td>
@Html.DisplayFor(modelItem => item.modified)
@Html.DisplayFor(modelItem => item.Modified)
</td>
<td>
@Html.DisplayFor(modelItem => item.photo)
@Html.DisplayFor(modelItem => item.Photo)
</td>
<td>
@Html.DisplayFor(modelItem => item.posted)
@Html.DisplayFor(modelItem => item.Posted)
</td>
<td>
@Html.DisplayFor(modelItem => item.rate)
@Html.DisplayFor(modelItem => item.Rate)
</td>
<td>
@Html.DisplayFor(modelItem => item.title)
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.visible)
@Html.DisplayFor(modelItem => item.Visible)
</td>
<td>
<ul class="actiongroup">

View File

@ -14,25 +14,25 @@
@SR["Author"]
</th>
<th>
@Html.DisplayNameFor(model => model.bcontent)
@Html.DisplayNameFor(model => model.Content)
</th>
<th>
@Html.DisplayNameFor(model => model.modified)
@Html.DisplayNameFor(model => model.Modified)
</th>
<th>
@Html.DisplayNameFor(model => model.photo)
@Html.DisplayNameFor(model => model.Photo)
</th>
<th>
@Html.DisplayNameFor(model => model.posted)
@Html.DisplayNameFor(model => model.Posted)
</th>
<th>
@Html.DisplayNameFor(model => model.rate)
@Html.DisplayNameFor(model => model.Rate)
</th>
<th>
@Html.DisplayNameFor(model => model.title)
@Html.DisplayNameFor(model => model.Title)
</th>
<th>
@Html.DisplayNameFor(model => model.visible)
@Html.DisplayNameFor(model => model.Visible)
</th>
<th></th>
</tr>
@ -43,25 +43,31 @@
@item.Author?.UserName
</td>
<td>
<div md-content="@item.bcontent"/>@item.bcontent
<div md-content="@item.Content"/>
</td>
<td>
@Html.DisplayFor(modelItem => item.modified)
<table>
<tr>
<td>
@Html.DisplayFor(modelItem => item.Modified)
</td>
<td>
@Html.DisplayFor(modelItem => item.photo)
@Html.DisplayFor(modelItem => item.Photo)
</td>
<td>
@Html.DisplayFor(modelItem => item.posted)
@Html.DisplayFor(modelItem => item.Posted)
</td>
<td>
@Html.DisplayFor(modelItem => item.rate)
@Html.DisplayFor(modelItem => item.Rate)
</td>
<td>
@Html.DisplayFor(modelItem => item.title)
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.visible)
@Html.DisplayFor(modelItem => item.Visible)
</td>
</tr>
</table>
</td>
<td>
<ul class="actiongroup">