public ActionResult FlagThisPost(int id, FlagPost fp) { fp.userID = (int)Session["userid"]; fp.PostID = id; context.FlagPosts.Add(fp); context.SaveChanges(); return(RedirectToAction("AllPosts", "Post")); }
public IHttpActionResult FlagPost(FlagPost fp) { context.FlagPosts.Add(fp); context.SaveChanges(); return(Created("api/posts/" + fp.FlagId, fp)); }