public ActionResult Post() { var model = Session["CreatePostModel"] as CreatePostModel; grabFromDB grab = new grabFromDB(); UserInfo temp = grab.getUserInfo(Globals.getCurrentUserEmail()); //string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Post post = new Post(); post.code = model.Code; post.condition = model.Condition; post.coursename = model.CourseName; post.date = DateTime.Now.ToString(); post.department = model.Department; post.description = model.Description; post.edition = model.Edition; post.email = Globals.getCurrentUserEmail(); post.Phone = temp.phone; post.price = model.Price; post.Title = model.Title; post.Uni = temp.university; post.author = model.Author; ViewBag.Success = grab.insertPost(post); return(View("Success")); }