public ActionResult CreateINGREDIENT(mycook.Models.ingredient usermodel)
        {
            mycookEntities me = new mycookEntities();



            var ingDetails = me.ingredients.Where(x => x.name_ingredient == usermodel.name_ingredient).FirstOrDefault();

            if (ingDetails == null)
            {
                ingredient newING = new ingredient();
                newING.name_ingredient = usermodel.name_ingredient;
                newING.status          = "ON";

                me.ingredients.Add(newING);
                me.SaveChanges();

                TempData["msg"] = "Record Saved Successfully.";
                // ViewBag.DataExists = true;
                // ViewBag.Javascript = "<script language='javascript' type='text/javascript'>alert('Data Already Exists');</script>";

                return(RedirectToAction("Index"));
            }
            else
            {
                usermodel.ErrorMessage = "Error";
            }


            return(View("Create"));
        }
        public ActionResult testeEdit([Bind(Include = "id_user,username,password,role, subscription")] ingredient i, mycook.Models.ingredient usermodel)
        {
            mycookEntities me = new mycookEntities();



            var ingDetails = me.ingredients.Where(x => x.id_ingredient == usermodel.id_ingredient).FirstOrDefault();

            if (ingDetails != null)
            {
                ingredient editado = ingDetails;
                editado.name_ingredient = usermodel.name_ingredient;
                editado.status          = "ON";
                usermodel.status        = "ON";

                i.status = "ON";

                me.SaveChanges();
                db.Entry(i).State = EntityState.Modified;
                //db.SaveChanges();
                // return RedirectToAction("Index");
                TempData["msg"] = "Record Saved Successfully.";
                // ViewBag.DataExists = true;
                // ViewBag.Javascript = "<script language='javascript' type='text/javascript'>alert('Data Already Exists');</script>";

                return(RedirectToAction("Index"));
            }
            else
            {
                usermodel.ErrorMessage = "Error";
            }
            return(RedirectToAction("Index"));
        }