예제 #1
0
        public ActionResult GetUserInfo(string id)
        {
            FungeyeDAL DAL = new FungeyeDAL();

            if (DAL.GetUserMushroomsByUserId(id).Count > 0)
            {
                List <UserMushroom> userMushrooms = DAL.GetUserMushroomsByUserId(id);
                string result = "";
                for (int i = 0; i < userMushrooms.Count; i++)
                {
                    result += $"{{ \"MushroomID\": \"{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}\", \"CommonName\": \"{userMushrooms[i].CommonName}\"}},";
                }

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

                ViewBag.Json = json;
            }

            ViewBag.Key           = DAL.GoogleKey;
            ViewBag.User          = DAL.GetUser(id);
            ViewBag.UserMushrooms = DAL.GetUserMushroomsByUserId(id);
            ViewBag.CurrentUser   = User.Identity.GetUserId();
            return(View("User"));
        }
예제 #2
0
        public ActionResult IdentifyMushrooms(string Id)
        {
            FungeyeDAL DAL = new FungeyeDAL();

            ViewBag.CapChars  = DAL.GetAllMushrooms().Select(x => x.CapChar).Distinct().ToList();
            ViewBag.CapColors = DAL.GetAllMushrooms().Select(x => x.CapColor).Distinct().ToList();
            ViewBag.Stems     = DAL.GetAllMushrooms().Select(x => x.Stem).Distinct().ToList();
            ViewBag.Edibility = DAL.GetAllMushrooms().Select(x => x.Edibility).Distinct().ToList();

            ViewBag.User      = DAL.GetUser(Id);
            ViewBag.Mushrooms = DAL.GetAllMushrooms();

            return(View());
        }