public IActionResult DeletePost(Post post) { User user = new User(); user.Id = (int)HttpContext.Session.GetInt32("Id"); _postLogic.DeletePost(post, user); return(RedirectToAction("Overview", "Profile")); }
public async Task <IActionResult> DeleteConfirmed(int PostId) { ViewBag.UserId = HttpContext.Session.GetInt32("UserId"); _postLogic.DeletePost(PostId); await _postLogic.Save(); // Get userId from session variable //var userId = HttpContext.Session.GetInt32("userId"); // redirect to Index // return RedirectToAction(nameof(DriverIndex), new { driverId = userId }); return(RedirectToAction(nameof(Index), "User")); }
// DELETE api/<controller>/5 public void Delete(int Id) { PostLogic.DeletePost(Id); }