/// <summary>
        /// This is the get Edit it finds the orchestra in the database with the id thats passed in
        /// ,then if its checked to see if it is null and if it isthen it sends you back to the
        /// orchestra index, if not then it sends you to the orchestra Edit view.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Edit(int id)
        {
            var orchestra = _repo.FindOrchestra(id);

            if (orchestra == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(orchestra));
        }
示例#2
0
        // <summary>
        /// This is the get create and it sends you the create view by passing in the orchestra id associated to the musician being created.
        /// Then it creates a new msician objectthen attaches it to the orchestra, then returns the view. View data is for orchestra information in the view.
        /// </summary>
        /// <returns></returns>
        public IActionResult Create([Bind(Prefix = "id")] int orchestraId)
        {
            var musician = new Musician();

            musician.OrchestraId = orchestraId;

            var orchestra = _repo.FindOrchestra(orchestraId);

            ViewData["Orchestra"] = orchestra;

            return(View());
        }