Blog comment comments
This commit is contained in:
@ -15,10 +15,11 @@ using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.ViewModels.Manage;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
|
||||
[Authorize]
|
||||
public class ManageController : Controller
|
||||
{
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
@ -91,7 +92,10 @@ namespace Yavsc.Controllers
|
||||
: "";
|
||||
|
||||
var user = await GetCurrentUserAsync();
|
||||
|
||||
long pc = _dbContext.Blogspot.Count(x => x.AuthorId == user.Id);
|
||||
|
||||
|
||||
|
||||
var model = new IndexViewModel
|
||||
{
|
||||
|
@ -228,7 +228,8 @@ namespace Yavsc.Controllers
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(long id)
|
||||
{
|
||||
BlogPost blog = _context.Blogspot.Single(m => m.Id == id && m.GetOwnerId()== User.GetUserId());
|
||||
var uid = User.GetUserId();
|
||||
BlogPost blog = _context.Blogspot.Single(m => m.Id == id && m.AuthorId == uid );
|
||||
|
||||
_context.Blogspot.Remove(blog);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
Reference in New Issue
Block a user