Exemple #1
0
        public AdminPanel(MainWindowVM mainWindow)
        {
            InitializeComponent();

            AdminPanelVM = new AdminPanelVM(mainWindow);
            DataContext  = AdminPanelVM;
        }
Exemple #2
0
        public ActionResult AdminPanel()
        {
            AdminPanelVM model = new AdminPanelVM();

            model.Users       = _userRepo.GetAllUsers();
            model.Categories  = _categoryRepo.GetAllCategories();
            model.StaticPages = _staticPageRepo.GetAllStaticPages();
            model.BlogPosts   = _blogPostRepo.GetAllBlogPostsWithCategoriesAndTags();

            return(View(model));
        }
Exemple #3
0
        public ActionResult AdminPanel()
        {
            AdminPanelVM model = new AdminPanelVM();

            model.Users       = _blogServices.GetAllUsers();
            model.Categories  = _blogServices.GetAllCategories();
            model.StaticPages = _staticPageServices.GetAllStaticPages();
            model.BlogPosts   = _blogServices.GetAllBlogPosts();

            return(View(model));
        }
        public IActionResult Index()
        {
            List <BookVM> books = _bookcontext.Books.Where(q => q.IsDeleted == false).Include(q => q.BookCategories).ThenInclude(BookCategories => BookCategories.Category).Include(q => q.BookPersons).ThenInclude(BookPerson => BookPerson.Person).Select(q => new BookVM()
            {
                BookID         = q.ID,
                Name           = q.Name,
                BookPersons    = q.BookPersons.Where(q => q.IsDeleted == false).ToList(),
                Publisher      = q.Publisher,
                PublishDate    = q.PublishDate,
                BookCategories = q.BookCategories.Where(q => q.IsDeleted == false).ToList(),
            }).ToList();

            List <UserVM> users = _bookcontext.Users.Where(q => q.IsDeleted == false).Select(q => new UserVM()
            {
                UserID    = q.ID,
                Name      = q.Name,
                SurName   = q.SurName,
                UserEmail = q.Email,
                BirthDate = q.BirthDate
            }).ToList();

            List <PersonVM> people = _bookcontext.People.Where(q => q.IsDeleted == false).Include(q => q.BookPeople).ThenInclude(BookPeople => BookPeople.Book).Include(q => q.PersonDuties).Select(q => new PersonVM()
            {
                PersonID  = q.ID,
                Name      = q.Name,
                SurName   = q.SurName,
                BirthDate = q.BirthDate,
                Duties    = q.PersonDuties.Where(q => q.IsDeleted == false).Select(q => q.DutyID == Convert.ToInt32(EnumDuty.Writer) ? EnumDuty.Writer.ToString() : EnumDuty.Interpreter.ToString()).ToList(),
                Books     = q.BookPeople.Where(q => q.IsDeleted == false).ToList()
            }).ToList();

            List <CategoryVM> categories = _bookcontext.Categories.Where(q => q.IsDeleted == false).Include(q => q.BookCategories).ThenInclude(BookCategories => BookCategories.Book).Select(q => new CategoryVM()
            {
                CategoryID   = q.ID,
                CategoryName = q.CategoryName,
                Books        = q.BookCategories.Where(q => q.IsDeleted == false).ToList()
            }).ToList();

            AdminPanelVM adminpanel = new AdminPanelVM();

            adminpanel.Books      = books;
            adminpanel.Categories = categories;
            adminpanel.People     = people;
            adminpanel.Users      = users;

            return(View(adminpanel));
        }
Exemple #5
0
        public AdminPanelVM GetAdminPanelVM()
        {
            var lostPets  = this.Context.LostPets;
            var foundPets = this.Context.FoundPets;
            var users     = this.Context.Users;

            var lostPetsVm  = Mapper.Map <IEnumerable <LostPet>, IEnumerable <AdminPanelLostPetVM> >(lostPets);
            var foundPetsVm = Mapper.Map <IEnumerable <FoundPet>, IEnumerable <AdminPanelFoundPetVM> >(foundPets);
            var usersVm     = Mapper.Map <IEnumerable <ApplicationUser>, IEnumerable <AdminPanelUserVM> >(users);

            var adminPanelVm = new AdminPanelVM
            {
                Users     = usersVm,
                LostPets  = lostPetsVm,
                FoundPets = foundPetsVm
            };

            return(adminPanelVm);
        }
Exemple #6
0
        public ActionResult AdminPanel()
        {
            AdminPanelVM vm = this.service.GetAdminPanelVM();

            return(View(vm));
        }