public ActionResult AddIngredient(string ingredient, string quantity)
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            PantryEntity pantryEntity = new PantryEntity(userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value, ingredient);

            pantryEntity.foodCategory   = "food";
            pantryEntity.quantity       = quantity;
            pantryEntity.ExpirationTime = DateTime.UtcNow;
            TableActions.AddRow("PantryTable", (TableEntity)pantryEntity);

            var results = TableActions.GetPantryResult("PantryTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);

            List <PantryModel> pantryItems = new List <PantryModel>();

            foreach (var item in results)
            {
                var pantryItem = item as PantryEntity;
                pantryItems.Add(new PantryModel {
                    Item = pantryItem.RowKey, Quantity = pantryItem.quantity
                });
            }

            return(View("Index", pantryItems));
        }
        // GET: Recommendations
        public async Task <ActionResult> Index()
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            IEnumerable <PreferenceEntity> preferenceEntities = TableActions.GetPreferencesResult("PreferenceTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);
            IEnumerable <PantryEntity>     pantryEntities     = TableActions.GetPantryResult("PantryTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);

            var preference = preferenceEntities.FirstOrDefault();
            IEnumerable <string> dietaryRestrictions = null;
            string diet = null;

            if (preference != null)
            {
                dietaryRestrictions = preference.healthPreference.Split(',');
                diet = preference.dietPreference;
            }

            string[]       foods                = { "pork", "bread", "peppers", "sugar", "corn" };
            string[]       pantryList           = pantryEntities.Select(x => x.RowKey).ToArray();
            IngredientList userPreferences      = new IngredientList(foods);
            IngredientList pantry               = new IngredientList(pantryList);
            List <Tuple <Recipe, double> > recs = await Recommender.GetRecommendations(userPreferences, pantry, dietaryRestrictions, diet);

            return(View(recs));
        }
        // GET: Pantry
        public ActionResult Index()
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            var results = TableActions.GetPantryResult("PantryTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);

            List <PantryModel> pantryItems = new List <PantryModel>();

            foreach (var item in results)
            {
                var pantryItem = item as PantryEntity;
                pantryItems.Add(new PantryModel {
                    Item = pantryItem.RowKey, Quantity = pantryItem.quantity
                });
            }

            return(View(pantryItems));
        }