Пример #1
0
        public IActionResult Create()
        {
            if (!this._middleware.CheckUserPermission(PermissionType.User, HttpContext))
            {
                return(RedirectToAction("Login", "User"));
            }

            // return all sectors
            SectorConverter sectorConverter = new SectorConverter();

            ViewData["Sectors"] = sectorConverter.ToSectorModelList(this._sectorContainer.GetAll());

            // return all courses
            CourseConverter courseConverter = new CourseConverter();

            ViewData["Courses"] = courseConverter.ToCourseModelList(this._courseContainer.GetAll());

            return(View());
        }
Пример #2
0
        public IActionResult Edit(int id)
        {
            if (!this._middleware.CheckUserPermission(PermissionType.User, HttpContext))
            {
                return(RedirectToAction("Login", "User"));
            }

            SectorConverter sectorConverter = new SectorConverter();

            ViewData["Sectors"] = sectorConverter.ToSectorModelList(this._sectorContainer.GetAll());

            CourseConverter courseConverter = new CourseConverter();

            ViewData["Courses"] = courseConverter.ToCourseModelList(this._courseContainer.GetAll());

            Book book = this._bookContainer.GetBookById(id);

            BookConverter bookConverter = new BookConverter();
            BookModel     bookModel     = bookConverter.ConvertBookToBookModel(book);

            return(View(bookModel));
        }