Пример #1
0
        public ActionResult ListSpecificMushroom(string mushroomID)
        {
            FungeyeDAL DAL = new FungeyeDAL();

            ViewBag.Mushroom = DAL.GetMushroomById(mushroomID);

            List <UserMushroom> UserMushrooms = DAL.GetUserMushroomsByMushroomId(mushroomID);

            if (UserMushrooms.Count > 0)
            {
                string result = "";
                for (int i = 0; i < UserMushrooms.Count; i++)
                {
                    result += $"{{ \"title\": \"{UserMushrooms[i].MushroomID}\", \"lat\": {UserMushrooms[i].Latitude}, \"lng\": {UserMushrooms[i].Longitude}, \"description\": \"{UserMushrooms[i].UserDescription}\", \"address\": \"{UserMushrooms[i].Address}\", \"ImageLink\": \"{UserMushrooms[i].PictureURL}\", \"email\": \"{UserMushrooms[i].Email}\", \"id\": \"{UserMushrooms[i].UserID}\"}},";
                }

                string resul = result.Substring(0, result.Length - 1);
                string json  = $"[{resul}]";

                ViewBag.Json          = json;
                ViewBag.UserMushrooms = UserMushrooms;
                ViewBag.CurrentUser   = User.Identity.GetUserId();
            }

            ViewBag.Key = DAL.GoogleKey;

            return(View("MushroomView"));
        }