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

Fixed blog post editing/creating putting you on a bad url after submit.

This commit is contained in:
Uncled1023 2016-10-16 23:54:21 -07:00
parent d3c1d7187b
commit 90c5f7d5c2

View File

@ -251,7 +251,7 @@ namespace Teknik.Areas.Blog.Controllers
db.BlogPosts.Add(post); db.BlogPosts.Add(post);
db.SaveChanges(); db.SaveChanges();
return Post(blog.User.Username, post.BlogPostId); return Redirect(Url.SubRouteUrl("blog", "Blog.Post", new { username = blog.User.Username, id = post.BlogPostId }));
} }
model.Error = true; model.Error = true;
model.ErrorMessage = "You are not authorized to create a post for this blog"; model.ErrorMessage = "You are not authorized to create a post for this blog";
@ -298,7 +298,7 @@ namespace Teknik.Areas.Blog.Controllers
post.DateEdited = DateTime.Now; post.DateEdited = DateTime.Now;
db.Entry(post).State = EntityState.Modified; db.Entry(post).State = EntityState.Modified;
db.SaveChanges(); db.SaveChanges();
return Post(post.Blog.User.Username, post.BlogPostId); return Redirect(Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId }));
} }
model.Error = true; model.Error = true;
model.ErrorMessage = "You are not authorized to edit this post"; model.ErrorMessage = "You are not authorized to edit this post";