public ActionResult CreatePosts(UserPosts posts) { if (!ModelState.IsValid) { return(View(posts)); } // int typeid= photo.PhotoId; var model = new UserPosts(); model.UserName = posts.UserName; model.Comments = posts.Comments; model.Createdon = System.DateTime.Now; // model.PhotoId = typeid; galRepo.UploadPosts(model); return(RedirectPermanent("/home")); }