public bool CreatePantry(PantryCreate model)
        {
            var entity = new Pantry()
            {
                OwnerId        = _userId,
                IngredientName = model.IngredientName,
                InStock        = model.InStock,
                Location       = model.Location,
                Quantity       = model.Quantity
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Pantry.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Create(PantryCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreatePantryService();

            if (service.CreatePantry(model))
            {
                TempData["SaveResult"] = "Your pantry was created.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Note could not be created.");

            return(View(model));
        }