code guidelines
This commit is contained in:
parent
58fb8cd530
commit
492427f4b8
82 changed files with 470 additions and 375 deletions
|
|
@ -13,10 +13,9 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
public class AnnouncesController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
IStringLocalizer<AnnouncesController> _localizer;
|
||||
|
||||
IAuthorizationService _authorizationService;
|
||||
private readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<AnnouncesController> _localizer;
|
||||
readonly IAuthorizationService _authorizationService;
|
||||
|
||||
public AnnouncesController(ApplicationDbContext context,
|
||||
IAuthorizationService authorizationService,
|
||||
|
|
@ -61,9 +60,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
ViewBag.IsAdmin = User.IsInRole(Constants.AdminGroupName);
|
||||
ViewBag.IsPerformer = User.IsInRole(Constants.PerformerGroupName);
|
||||
ViewBag.AllowEdit = (announce!=null && announce.Id>0) ?
|
||||
await _authorizationService.AuthorizeAsync(User,announce,new EditRequirement()) :
|
||||
true;
|
||||
ViewBag.AllowEdit = announce==null || announce.Id<=0 || await _authorizationService.AuthorizeAsync(User,announce,new EditRequirement());
|
||||
List<SelectListItem> dl = new List<SelectListItem>();
|
||||
var rnames = System.Enum.GetNames(typeof(Reason));
|
||||
var rvalues = System.Enum.GetValues(typeof(Reason));
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Yavsc.Controllers
|
|||
|
||||
// GET: Blog
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> Index(string id, int skip=0, int maxLen=25)
|
||||
public async Task<IActionResult> Index(string id)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(id)) {
|
||||
return await UserPosts(id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue