Ejemplo n.º 1
0
        public ActionResult Index(string id)
        {
            //see if this is a new story
            if (string.IsNullOrEmpty(id))
            {
                return(View(new ComicStory()));
            }

            //fetch the data
            ComicStory comicStory;

            try
            {
                comicStory = _mongoRepositiry.GetStoryById(id);
            }
            catch (FormatException)
            {
                throw new ArgumentException("The story Id you have provided is invalid, or the story is corrupted");
            }

            //ensure data is valid
            if (comicStory == null)
            {
                throw new ArgumentException("The story you requested could not be found");
            }

            //return view
            return(View(comicStory));
        }