// Note: can be forged as we don't have an anti forgery token.  Will need to add this
        public async Task <JsonResult> Ate(int?id)
        {
            // verify id is actually a real apple
            if (id == null)
            {
                return(Json(new { success = false, message = "id expected" }));
            }
            //if (!AppleExists((int)id))
            if (!await _appleRepo.ExistsAsync((int)id))
            {
                return(Json(new { success = false, message = "appleID not found" }));
            }

            // and that we have a logged in user
            string aspNetUserID = _userManager.GetUserId(User);

            if (aspNetUserID == null)
            {
                return(Json(new { success = false, message = "user not logged in" }));
            }
            FujiUser fu = null;

            if (aspNetUserID != null)
            {
                //fu = _context.FujiUsers.Where(u => u.AspnetIdentityId == aspNetUserID).FirstOrDefault();
                fu = _fuRepo.GetFujiUserByIdentityId(aspNetUserID);
                if (fu == null)
                {
                    return(Json(new { success = false, message = "user not found" }));
                }
            }

            // Now we have a verified Apple and a verified User.  Let that user eat that apple!

            /*ApplesConsumed appleCore = new ApplesConsumed {
             *  Apple = await _context.Apples.FirstOrDefaultAsync(a => a.Id == id),
             *  FujiUser = fu,
             *  ConsumedAt = DateTime.UtcNow,
             *  Count = 1
             * };
             * _context.Add(appleCore);
             * await _context.SaveChangesAsync();
             */
            await _fuRepo.EatAsync(fu, (int)id, DateTime.UtcNow);

            return(Json(new { success = true, message = "user ate apple" }));
        }
        public async Task <IActionResult> Index()
        {
            // Information from Identity through the user manager
            string       id   = _userManager.GetUserId(User);          // reportedly does not need to hit the db
            IdentityUser user = await _userManager.GetUserAsync(User); // does go to the db

            FujiUser fu = null;

            if (id != null)
            {
                //fu = _fujiDbContext.FujiUsers.Where(u => u.AspnetIdentityId == id).FirstOrDefault();
                fu = _fuRepo.GetFujiUserByIdentityId(id);
            }

            //var appleList = _fujiDbContext.Apples.ToList();
            var        appleList = _appleRepo.GetAll().ToList();
            MainPageVM vm        = new MainPageVM {
                TheIdentityUser = user, TheFujiUser = fu, Apples = appleList
            };

            ViewBag.TotalConsumed = _appleRepo.GetTotalConsumed(_appleRepo.GetAll());

            return(View(vm));
        }