Пример #1
0
        public async Task <IActionResult> Index()
        {
            int waitConfirmRecipeCount = await _recipeRepository.CountAsync(r => !r.IsConfirmed && !r.IsDeleted);

            int waitConfirmFoodCategoryCount = await _foodCategoryRepository.CountAsync(f => !f.IsConfirmed && !f.IsDeleted);

            int waitConfirmCommentCount = await _commentRepository.CountAsync(c => !c.IsConfirmed && !c.IsDeleted);

            int notConfirmedAndDeletedRecipeCount = await _recipeRepository.CountAsync(r => r.IsDeleted && !r.IsConfirmed);

            int notConfirmedAndDeletedFoodCategoryCount = await _foodCategoryRepository.CountAsync(f => f.IsDeleted && !f.IsConfirmed);

            int notConfirmedAndDeletedCommentCount = await _commentRepository.CountAsync(c => c.IsDeleted && !c.IsConfirmed);

            var model = new HomeIndexViewModel
            {
                WaitConfirmRecipeCount       = waitConfirmRecipeCount,
                WaitConfirmFoodCategoryCount = waitConfirmFoodCategoryCount,
                WaitConfirmCommentCount      = waitConfirmCommentCount,

                NotConfirmedAndDeletedRecipeCount       = notConfirmedAndDeletedRecipeCount,
                NotConfirmedAndDeletedFoodCategoryCount = notConfirmedAndDeletedFoodCategoryCount,
                NotConfirmedAndDeletedCommentCount      = notConfirmedAndDeletedCommentCount
            };

            return(View(model));
        }
Пример #2
0
        public async Task <PaginatedList <FilterModel> > GetFiltersByRecipeId(Guid id)
        {
            var filters = _repository.GetFiltersByRecipeId(id);

            var filM = new List <Filters>();

            foreach (var fil in filters.Result)
            {
                filM.Add(fil.Filter);
            }

            return(new PaginatedList <FilterModel>(
                       1,
                       filters.Result.Count,
                       await _repository.CountAsync(),
                       _mapper.Map <IList <FilterModel> >(filM)));
        }
Пример #3
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            var roles = await _userManager.GetRolesAsync(user);

            if (user == null || roles == null)
            {
                return(Content("Kullanıcı veya Yetki Hatası"));
            }

            int deletedRecipeCount = await _recipeRepository.CountAsync(x => x.IsDeleted && x.IsConfirmed);

            int deletedFoodCategoryCount = await _foodCategoryRepository.CountAsync(x => x.IsDeleted && x.IsConfirmed);

            int deletedCommentCount = await _commentRepository.CountAsync(x => x.IsDeleted && x.IsConfirmed);

            int recipeCount = await _recipeRepository.CountAsync(c => !c.IsDeleted && c.IsConfirmed);

            int foodCategoryCount = await _foodCategoryRepository.CountAsync(c => !c.IsDeleted && c.IsConfirmed);

            int commentCount = await _commentRepository.CountAsync(c => !c.IsDeleted && c.IsConfirmed);

            int userCount = _userManager.Users.Count();
            int roleCount = _roleManager.Roles.Count();

            return(View(new RightSideBarViewModel
            {
                Roles = roles,
                User = user,
                RecipeDeletedCount = deletedRecipeCount,
                FoodCategoryDeletedCount = deletedFoodCategoryCount,
                CommentDeletedCount = deletedCommentCount,

                RecipeCount = recipeCount,
                FoodCategoryCount = foodCategoryCount,
                CommentCount = commentCount,

                UserCount = userCount,
                RoleCount = roleCount
            }));
        }