示例#1
0
        public IActionResult GetAll()
        {
            if (_feedbackService.GetAll() == null)
            {
                return(NotFound());
            }

            return(Ok(_feedbackService.GetAll()));
        }
示例#2
0
        public IActionResult GetAllFeedback()
        {
            /*List<Feedback> allFeedback = feedbackService.GetAll().ToList();
             * List<AllFeedbackDTO> allFeedbackDTOs = FeedbackAdapter.ListAllFeedbackToListAllFeedbackDTO(allFeedback);*/
            List <Domain.Entities.Feedback> allFeedback     = _feedbackService.GetAll().ToList();
            List <AllFeedbackDTO>           allFeedbackDTOs = FeedbackMapper.ListAllFeedbackToListAllFeedbackDTO(allFeedback);

            return(Ok(allFeedbackDTOs));
        }
 public IActionResult GetAll()
 {
     try
     {
         return(Ok(_feedbackService.GetAll()));
     }catch (Exception)
     {
         return(StatusCode(500));
     }
 }
示例#4
0
 public HttpResponseMessage GetItemCount(HttpRequestMessage request)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         var dashBoardVm = new DashBoardViewModel()
         {
             TotalProducts = _productService.GetAll().Count(),
             TotalUsers = _userManager.Users.Count(),
             TotalOrders = _orderService.GetAll("").Count(),
             TotalFeedbacks = _feedbackService.GetAll("").Count()
         };
         response = request.CreateResponse(HttpStatusCode.OK, dashBoardVm);
         return response;
     }));
 }
        public JsonResult GetAll(string searchstr, int page, int pageSize = 5)
        {
            var model        = _feedbackService.GetAll(searchstr);
            var feedbackList = Mapper.Map <IEnumerable <Feedback>, IEnumerable <FeedbackViewModel> >(model);
            var data         = feedbackList.
                               Skip((page - 1) * pageSize).
                               Take(pageSize);
            int totalRow = feedbackList.Count();

            return(Json(new
            {
                data = data,
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
示例#6
0
 public HttpResponseMessage GetListFeedback(HttpRequestMessage request, string keyword, int page, int pageSize = 10)
 {
     return(CreateHttpResponse(request, () =>
     {
         int totalRow = 0;
         var model = _feedbackService.GetAll(keyword);
         totalRow = model.Count();
         var query = model.OrderByDescending(x => x.CreatedDate).Skip(page * pageSize).Take(pageSize);
         var responseData = Mapper.Map <IEnumerable <Feedback>, IEnumerable <FeedbackViewModel> >(query);
         var paginationSet = new PaginationSet <FeedbackViewModel>()
         {
             Items = responseData,
             Page = page,
             TotalCount = totalRow,
             TotalPages = (int)Math.Ceiling((decimal)totalRow / pageSize)
         };
         var response = request.CreateResponse(HttpStatusCode.OK, paginationSet);
         return response;
     }));
 }
        public HttpResponseMessage GetAll(HttpRequestMessage request, string keyword, int page, int pageSize = 20)
        {
            return(CreateHttpResponse(request, () =>
            {
                int totalRow = 0;
                var model = _feedbackService.GetAll(keyword);                                                   //lấy về toàn bộ số bản ghi và từ khoá tìm kiếm

                totalRow = model.Count();                                                                       //đếm
                var query = model.OrderByDescending(x => x.CreateDate).Skip(page * pageSize).Take(pageSize);
                var reponseData = Mapper.Map <IEnumerable <Feedback>, IEnumerable <FeedbackViewModel> >(query); //lấy giữ liệu thông qua mapper và duyệt từng phần từ

                var paginationSet = new PaginationSet <FeedbackViewModel>()
                {
                    Items = reponseData,
                    Page = page,
                    TotalCount = totalRow,
                    TotalPages = (int)Math.Ceiling((decimal)totalRow / pageSize)
                };
                var response = request.CreateResponse(HttpStatusCode.OK, paginationSet);
                return response;
            }));
        }
        public async Task <ActionResult <object> > GetAsync([FromQuery] int draw, [FromQuery(Name = "start")] int skip, [FromQuery(Name = "length")] int take)
        {
            var feedbacks = (await _feedbackService.GetAll(new FilterModel {
                Skip = skip, Take = take
            })).
                            Select(x => new FeedbackModel
            {
                Name    = x.UserName,
                Message = x.Message,
                Created = x.Created
            }).Reverse().ToList();

            var count = await _feedbackService.GetCount();

            var result = new DateTableResult <FeedbackModel>
            {
                Draw     = draw,
                Total    = count,
                Filtered = count,
                Data     = feedbacks
            };

            return(Ok(result));
        }
示例#9
0
        public async Task <IActionResult> Index()
        {
            ViewData["BodyClass"] = "cms-index-index cms-home-page";

            var cacheEntry = await _cache.GetOrCreateAsync(CacheKeys.HomeController, entry =>
            {
                entry.SlidingExpiration = TimeSpan.FromMinutes(30);
                var homeVm = new HomeViewModel()
                {
                    MetaDescription           = CommonConstants.HomeMeta.Description,
                    MetaKeyword               = CommonConstants.HomeMeta.Keyword,
                    SeoTitle                  = CommonConstants.HomeMeta.Title,
                    BlogViewModels            = _blogService.GetAll().Where(x => x.HomeFlag == Status.Active).ToList(),
                    FeedbackViewModels        = _feedbackService.GetAll().Where(x => x.Status == Status.Active).ToList().Take(10).ToList(),
                    ProductViewModels         = _productService.GetAll().Where(x => x.Status == Status.Active).ToList(),
                    SlideViewModels           = _slideService.GetAll().Where(x => x.Status == Status.Active).OrderBy(x => x.SortOrder).ToList(),
                    ProductCategoryViewModels = _productCategoryService.GetAllNoMapping().Where(x => x.Status == Status.Active).ToList(),
                    AdvertisementViewModels   = _advertisementService.GetClientSideAds(CommonConstants.AdsPages.Home)
                };
                return(Task.FromResult(homeVm));
            });

            return(View(cacheEntry));
        }
        // GET: Feedback
        public ActionResult Index()
        {
            var feedback = feedbackService.GetAll();

            return(View(feedback));
        }
示例#11
0
 public async Task <IActionResult> GetAll()
 {
     return(Ok(await _feedbackService.GetAll()));
 }