1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Fixed not being able to edit main blog

This commit is contained in:
Uncled1023 2016-09-30 13:19:13 -07:00
parent 667ef65682
commit 5040f98cf6
3 changed files with 5 additions and 5 deletions

View File

@ -116,7 +116,7 @@ namespace Teknik.Areas.Blog.Controllers
return View("~/Areas/Blog/Views/Blog/ViewPost.cshtml", model);
}
public ActionResult NewPost(string username)
public ActionResult NewPost(string username, int blogID)
{
if (string.IsNullOrEmpty(username))
{
@ -125,7 +125,7 @@ namespace Teknik.Areas.Blog.Controllers
BlogViewModel model = new BlogViewModel();
// find the post specified
bool isAuth = User.IsInRole("Admin");
var blog = db.Blogs.Where(p => (p.User.Username == username) && (p.User.Username == User.Identity.Name || isAuth)).FirstOrDefault();
var blog = db.Blogs.Where(p => (p.BlogId == blogID) && (p.User.Username == User.Identity.Name || isAuth)).FirstOrDefault();
if (blog != null)
{
model = new BlogViewModel(blog);

View File

@ -4,8 +4,8 @@
<script>
// We need to define the action URLs for the script
var uploadURL = '@Url.SubRouteUrl("upload", "Upload.Upload")';
var helpURL = '@Url.SubRouteUrl("help", "Help.Markdown")';
var getPostsURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "GetPosts" })';
var publishPostURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "PublishPost" })';
@ -41,7 +41,7 @@
{
<div class="row">
<div class="col-sm-12 text-center">
<a href="@Url.SubRouteUrl("blog", "Blog.New", new { username = Model.User.Username })" role="button" class="btn btn-primary">Create Post</a>
<a href="@Url.SubRouteUrl("blog", "Blog.New", new { username = Model.User.Username, blogID = Model.BlogId })" role="button" class="btn btn-primary">Create Post</a>
</div>
</div>
}

View File

@ -4,8 +4,8 @@
<script>
// We need to define the action URLs for the script
var uploadURL = '@Url.SubRouteUrl("upload", "Upload.Upload")';
var helpURL = '@Url.SubRouteUrl("help", "Help.Markdown")';
var getPostsURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "GetPosts" })';
var publishPostURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "PublishPost" })';