Beispiel #1
0
        // This method may be unnecessary
        public static void FindRecipeInDB(Recipe Selected)
        {
            pantrypartyEntities ORM = new pantrypartyEntities();

            if (ORM.Recipes.Find(Selected.ID) == null)
            {
                ORM.Recipes.Add(Selected);
                ORM.SaveChanges();
            }
        }
Beispiel #2
0
        // Deletes an ingredient with the selected name from the DB and sends back to the Delete view
        public ActionResult Delete(string CurrentUser, string ItemToDelete)
        {
            //try
            //{
            pantrypartyEntities ORM = new pantrypartyEntities();

            ORM.UserIngredients.RemoveRange(ORM.UserIngredients.Where(x => (x.UserID == CurrentUser && x.IngredientID == ItemToDelete)));
            ORM.SaveChanges();
            return(EditIngred(CurrentUser));
            //}
            //catch (Exception)
            //{
            //    return View("../Shared/Error");
            //}
        }
Beispiel #3
0
        //SAVED EDIT PROFILE
        public ActionResult SaveProfChanges(AspNetUser NUser)
        {
            //if (!ModelState.IsValid)
            //{
            //    return View("../Shared/Error");
            //}
            pantrypartyEntities ORM         = new pantrypartyEntities();
            AspNetUser          CurrentUser = ORM.AspNetUsers.Find(NUser.ID);

            CurrentUser.FirstName      = NUser.FirstName;
            CurrentUser.LastName       = NUser.LastName;
            CurrentUser.PhoneNumber    = NUser.PhoneNumber;
            CurrentUser.Address        = NUser.Address;
            CurrentUser.City           = NUser.City;
            CurrentUser.State          = NUser.State;
            CurrentUser.Zipcode        = NUser.Zipcode;
            CurrentUser.EmailConfirmed = NUser.EmailConfirmed;

            ORM.Entry(ORM.AspNetUsers.Find(NUser.ID)).CurrentValues.SetValues(CurrentUser); //finding old object, replacing it with new information

            ORM.SaveChanges();
            return(RedirectToAction("Index"));
        }