示例#1
0
        //// GET: BarUserComments/Details/5
        public async Task <IActionResult> Details(Guid barId, Guid userId)
        {
            if (barId == null || userId == null)
            {
                return(NotFound());
            }

            var comment = await _service.GetAsync(barId, userId);

            if (comment == null)
            {
                return(NotFound());
            }

            return(View(_mapper.MapDTOToView(comment)));
        }
        // GET: BarUserComments
        public async Task <IActionResult> Index(Guid barId, string page = "0", string itemsOnPage = "12")
        {
            try
            {
                var comments = await _service.GetAllAsync(barId, page, itemsOnPage);

                ViewBag.Count       = comments.Count();
                ViewBag.CurrentPage = int.Parse(page);
                ViewBag.ItemsOnPage = int.Parse(itemsOnPage);
                ViewBag.CurrentBar  = barId;

                return(View(comments.Select(b => _mapper.MapDTOToView(b))));
            }
            catch (Exception)
            {
                return(Error());
            }
        }