public ActionResult Index(UserData post) { SessionStatus(); var user = System.Web.HttpContext.Current.GetMySessionObject(); if (user == null) { return(View()); } UserData u = new UserData { Username = user.Username, Level = user.Level }; if (ModelState.IsValid) { PostsTable data = new PostsTable { Title = post.Title, Text = post.Text, Image = post.Image, }; var userLogin = _posts.SetPostsList(data); if (userLogin.Status) { return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", userLogin.StatusMsg); return(View()); } } return(View(u)); }