Beispiel #1
0
        public ActionResult Edit(long id)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "Error"));
            }
            var entity = _specialtyService.Find(id);

            if (entity == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            var courses = _courseService.Queryable().ToList();
            var model   = new SpecialtyEditViewModel
            {
                Courses       = new SelectList(courses, "CourseId", "CourseNumber"),
                CourseId      = entity.CourseId,
                SpecialtyId   = entity.SpecialtyId,
                SpecialtyName = entity.Name
            };

            return(View(model));
        }