public void SaveChangesSubFoodGroupToDB(SubFoodGroup employee)
        {
            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommand cmd = new SqlCommand("spSaveChangesSubFoodGroup", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter paramFoodName = new SqlParameter();
                paramFoodName.ParameterName = "@FoodName";
                paramFoodName.Value         = employee.SubFoodGroupName;
                cmd.Parameters.Add(paramFoodName);

                SqlParameter paramId = new SqlParameter();
                paramId.ParameterName = "@FoodGroupId";
                paramId.Value         = employee.SubFoodGroupId;
                cmd.Parameters.Add(paramId);

                SqlParameter FoodGrpparamId = new SqlParameter();
                FoodGrpparamId.ParameterName = "@GroupId";
                FoodGrpparamId.Value         = employee.FoodGroupId;
                cmd.Parameters.Add(FoodGrpparamId);

                con.Open();
                cmd.ExecuteNonQuery();
            }
        }
        //[ValidateAntiForgeryToken]
        public ActionResult Edit(BusinessLayer.SubFoodGroup fooditem)
        {
            if (ModelState.IsValid)
            {
                dbset.SaveChangesSubFoodGroupToDB(fooditem);
                return(RedirectToAction("Index"));
            }
            ViewBag.FoodGroupId = new SelectList(dbset.FoodGroups.OrderBy(x => x.FoodGroupName), "FoodGroupId", "FoodGroupName", fooditem.FoodGroupId);

            return(View(fooditem));
        }
        public ActionResult Edit(decimal id)
        {
            BusinessLayer.SubFoodGroup fooditem = dbset.SubFoodGroups.Single(emp => emp.SubFoodGroupId == id);
            if (fooditem == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FoodGroupId = new SelectList(dbset.FoodGroups.OrderBy(x => x.FoodGroupName), "FoodGroupId", "FoodGroupName", fooditem.FoodGroupId);

            return(View(fooditem));
        }
        //[ActionName("Create")]
        //[ValidateAntiForgeryToken]
        public ActionResult Create(BusinessLayer.SubFoodGroup fooditem)//Create(FormCollection formCollection)
        {
            //if (ModelState.IsValid)
            //{
            var subgrpname = fooditem.SubFoodGroupName;
            var foodgrpid  = fooditem.FoodGroupId;

            dbset.AddSubFoodGroupToDB(fooditem);
            return(RedirectToAction("Index"));

            //}
            ViewBag.FoodGroupId = new SelectList(dbset.FoodGroups.OrderBy(x => x.FoodGroupName), "FoodGroupId", "FoodGroupName");

            return(View());
        }