// If Farmer, return their FarmID
        // After validation, returns the UserID as well
        public int ValidateUser(out string userID) // Output parameter
        {
            userID = null;
            int farmID = 0;

            if (User.Identity.IsAuthenticated)
            {
                userID = User.FindFirst(ClaimTypes.NameIdentifier).Value;
                if (User.IsInRole("Farmer"))
                {
                    farmID = farmRepoInterface.FindFarmOfFarmer(userID);
                }
            }

            return(farmID);
        }
        public IActionResult ListAllCropsGrownByMyFarm(string analystID)
        {
            HttpContext.Session.SetString("AnalystID", analystID);

            var userID = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var farmID = farmRepo.FindFarmOfFarmer(userID);

            ViewData["FarmName"] = database.Farms.Find(farmID).FarmName;

            var canProduceList = database.CanProduce
                                 .Include(cp => cp.Crop)
                                 .Where(cp => cp.FarmID == farmID)
                                 .ToList();

            return(View(canProduceList));
        }