un positionnement de paramètre workflow des pros

This commit is contained in:
Paul Schneider 2017-01-13 16:31:40 +01:00
commit 96746fcc0b
322 changed files with 25893 additions and 3844 deletions

View file

@ -10,6 +10,7 @@ using Microsoft.AspNet.Authorization;
using Microsoft.Data.Entity;
using Microsoft.Extensions.OptionsModel;
using Yavsc.Models;
using Yavsc.ViewModels.Auth;
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
@ -38,22 +39,27 @@ namespace Yavsc.Controllers
// GET: Blog
[AllowAnonymous]
public IActionResult Index(string id)
public IActionResult Index(string id, int skip=0, int maxLen=25)
{
string uid = null;
if (User.IsSignedIn())
uid = User.GetUserId();
if (!string.IsNullOrEmpty(id))
return UserPosts(id);
return View(_context.Blogspot.Include(
b => b.Author
).Where(p => p.Visible).Take(10));
).Where(p => p.Visible || p.AuthorId == uid ).OrderByDescending(p => p.Posted)
.Skip(skip).Take(maxLen));
}
[Route("/Title/{id?}")]
[AllowAnonymous]
public IActionResult Title(string id)
{
var uid = User.GetUserId();
return View("Index", _context.Blogspot.Include(
b => b.Author
).Where(x => x.Title == id && x.Visible).ToList());
).Where(x => x.Title == id && (x.Visible || x.AuthorId == uid )).ToList());
}
[Route("/Blog/{id?}")]
@ -88,7 +94,7 @@ namespace Yavsc.Controllers
{
return HttpNotFound();
}
return View(blog);
}
@ -115,7 +121,7 @@ namespace Yavsc.Controllers
_context.SaveChanges();
return RedirectToAction("Index");
}
_logger.LogWarning("Invalid Blog posted ...");
ModelState.AddModelError("Unknown","Invalid Blog posted ...");
return View(blog);
}
[Authorize()]