public ActionResult Edit(decimal id)
        {
            BusinessLayer.FoodWeightType fooditem = dbset.FoodWeightTypes.Single(emp => emp.FoodWeightTypeId == id);
            if (fooditem == null)
            {
                return(HttpNotFound());
            }

            return(View(fooditem));
        }
        //[ValidateAntiForgeryToken]
        public ActionResult Edit(BusinessLayer.FoodWeightType fooditem)
        {
            if (ModelState.IsValid)
            {
                dbset.SaveChangesFoodWeightTypeToDB(fooditem);
                //db.Entry(fooditem).State = EntityState.Modified;
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(fooditem));
        }
        //[ActionName("Create")]
        //[ValidateAntiForgeryToken]
        public ActionResult Create(BusinessLayer.FoodWeightType fooditem)//Create(FormCollection formCollection)
        {
            if (ModelState.IsValid)
            {
                dbset.AddFoodWeightTypeToDB(fooditem);
                return(RedirectToAction("Index"));
            }

            //ViewBag.FoodGroupId = new SelectList(dbset.FoodGroups, "FoodGroupId", "FoodGroupName");

            return(View());
        }
        public void AddFoodWeightTypeToDB(FoodWeightType employee)
        {
            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommand cmd = new SqlCommand("spAddFoodWeightType", con);
                cmd.CommandType = CommandType.StoredProcedure;

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

                con.Open();
                cmd.ExecuteNonQuery();
            }
        }