Exemple #1
0
        public IActionResult DetailDrugStore(int id)
        {
            List <DrugDetails> lst = DetailDrugStoreRes.GetAll().Where(i => i.iddrugstore == id).ToList();

            ViewData["idstore"] = id;
            return(View(lst));
        }
Exemple #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());
        }
Exemple #3
0
        public IActionResult DeleteDrugCategory(int id)
        {
            object[] value        = { id };
            var      errorCode    = 0;
            var      errorMessage = "";

            string[]    output = { };
            DrugDetails store  = DetailDrugStoreRes.GetAll().Where(i => i.id == id).FirstOrDefault();
            var         result = DetailDrugStoreRes.DeleteDetailDrugStore(value, ref output, ref errorCode, ref errorMessage);

            return(RedirectToAction("DetailDrugStore", new { @id = store.iddrugstore }));
        }
Exemple #4
0
 public IActionResult DetailDrugStoregetvalue(string id, string drugname, string price, string note, string idstore)
 {
     if (drugname != null && price != null)
     {
         object[] value        = { id, drugname, price, note, idstore };
         var      errorCode    = 0;
         var      errorMessage = "";
         string[] output       = { };
         var      result       = DetailDrugStoreRes.SaveDrugDetail(value, ref output, ref errorCode, ref errorMessage);
     }
     else
     {
         TempData["AlertMessageError"] = "Vui lòng nhập đủ thông tin thuốc ";
     }
     return(RedirectToAction("DetailDrugStore", new { @id = idstore }));
 }
Exemple #5
0
        public IActionResult DetailUserDrugStore(int id)
        {
            DrugStore store = DrupStoreRes.GetAll().Where(i => i.iduser == id).FirstOrDefault();

            if (store != null)
            {
                List <DrugDetails> lst = DetailDrugStoreRes.GetAll().Where(i => i.iddrugstore == store.ID).ToList();
                return(RedirectToAction("DetailDrugStore", new { @id = store.ID }));
            }
            else
            {
                TempData["AlertMessageError"] = "Không có  dữ liệu nhà thuốc ";
                return(RedirectToAction("ListAccount", "Account"));
            }

            return(View());
        }