Пример #1
0
        public IActionResult CommentDetailDrugStore(int id)
        {
            List <Comment> lst = DrupStoreRes.GetAllCmt().Where(i => i.storeId == id).ToList();

            ViewData["storeId"] = id;
            return(View(lst));
        }
Пример #2
0
        public IActionResult DetailStore(int id, string Search)
        {
            List <DrugStore> lst1 = DrupStoreRes.GetTopfive().Take(4).ToList();

            ViewData["Topfive"] = lst1;
            DrugStore lst = DrupStoreRes.GetAll().Where(i => i.ID == id).FirstOrDefault();

            ViewBag.search = Search;
            //code moi
            ViewData["lat"]         = lst.lat;
            ViewData["lng"]         = lst.lng;
            ViewData["storeid"]     = id;
            ViewData["phone"]       = lst.phone;
            ViewData["name"]        = lst.name;
            ViewData["imgSrc"]      = lst.imgSrc;
            ViewData["opentime"]    = lst.openTime;
            ViewData["closedtime"]  = lst.closedTime;
            ViewData["description"] = lst.description;
            ViewData["address"]     = lst.address;

            List <Comment> lstcmt = DrupStoreRes.GetAllCmt().Where(i => i.storeId == id).ToList();

            ViewData["countCmt"] = lstcmt.Count;
            ViewData["comments"] = lstcmt;
            int sum = 0;

            for (int i = 0; i < lstcmt.Count; i++)
            {
                sum += lstcmt[i].rating;
            }
            int count = 0;

            if (lstcmt.Count == 0)
            {
                count = 1;
            }
            else
            {
                count = lstcmt.Count;
            }

            ViewData["average"] = sum / count;
            List <DrugDetails> detail = DetailDrugStoreRes.GetAll().Where(i => i.iddrugstore == id).ToList();

            ViewData["detail"] = detail;


            List <Comment> lstcmt1 = DrupStoreRes.GetAllCmt().Where(i => i.storeId == id && i.rating == 4).ToList();

            ViewData["dem4"] = lstcmt1.Count;



            return(View());
        }
Пример #3
0
        public IActionResult CommentDetailDeleteDrugStore(int id)
        {
            object[] value        = { id };
            var      errorCode    = 0;
            var      errorMessage = "";

            string[] output = { };
            Comment  store  = DrupStoreRes.GetAllCmt().Where(i => i.cid == id).FirstOrDefault();
            var      result = DrupStoreRes.DeleteComment(value, ref output, ref errorCode, ref errorMessage);

            if (result)
            {
                TempData["AlertMessage"] = "Xóa Bình luận Thành Công";
            }
            return(RedirectToAction("CommentDetailDrugStore", new { @id = store.storeId }));
        }