Exemple #1
0
        public ActionResult AddStory(StoryVM storyVM)
        {
            StoryManager sm = new StoryManager();

            int UserID = (int)Session["ActiveUser"];

            if (storyVM != null)
            {
                if (Directory.Exists(Server.MapPath("~/files")) == false)
                {
                    Directory.CreateDirectory(Server.MapPath("~/files"));
                }

                string path = (Path.Combine(Server.MapPath("~/files"), storyVM.file.FileName));
                storyVM.file.SaveAs(path);
                sm.InsertStory(path, storyVM.StoryComment, UserID);
                return(RedirectToAction("HomePage"));
            }

            return(View());
        }