Пример #1
0
        // GET: Photos/Details/5
        public ActionResult Details(int id)
        {
            var operaRecord = _repo.Get(id);

            ViewBag.ForComment = "This text for comment view";

            var opera = new Opera()
            {
                OperaID  = 101,
                Title    = "Title",
                Year     = 1945,
                Composer = "Mozart",
                Comments = new List <Comment>()
                {
                    new Comment {
                        CommentId = 101, Subject = "CommentSubject1", CommentText = "Comment #1"
                    },
                    new Comment {
                        CommentId = 102, Subject = "CommentSubject2", CommentText = "Comment #2"
                    },
                    new Comment {
                        CommentId = 103, Subject = "CommentSubject3", CommentText = "Comment #3"
                    }
                }
            };

            return(View("Details", opera));
        }
Пример #2
0
        public ActionResult Details(int id)
        {
            //Opera opera = contextDB.Operas.Find(id);
            var opera = _repo.Get(id);

            if (opera != null)
            {
                return(View("Details", opera));
            }
            else
            {
                return(HttpNotFound());
            }
        }