public ActionResult Create(MenuItem menuitem, HttpPostedFileBase imgMenu)
        {
            if (ModelState.IsValid)
            {
                menuitem.IsDeleted = false;
                db.MenuItems.AddObject(menuitem);
                db.SaveChanges();


                if (imgMenu != null)
                {
                    string strPath = "~/Content/Uploads/Menu/" + menuitem.MenuID;
                    if (!Directory.Exists(Server.MapPath(strPath)))
                    {
                        Directory.CreateDirectory(Server.MapPath(strPath));
                    }
                    if (imgMenu != null && imgMenu.ContentLength > 0)
                    {
                        string filePath = Path.Combine(HttpContext.Server.MapPath(strPath),
                                                           Path.GetFileName(menuitem.MenuID + "_" + imgMenu.FileName));

                        if (!System.IO.File.Exists(filePath))
                        {
                            imgMenu.SaveAs(filePath);
                            menuitem.Image = menuitem.MenuID + "_" + imgMenu.FileName;
                        }
                        else
                        {
                            imgMenu.SaveAs(Path.Combine(HttpContext.Server.MapPath(strPath), Path.GetFileName(DateTime.Now.ToLongTimeString().Replace(":", "") + menuitem.MenuID + "_" + imgMenu.FileName)));

                            menuitem.Image = DateTime.Now.ToLongTimeString().Replace(":", "") + menuitem.MenuID + "_" + imgMenu.FileName;
                        }
                    }

                    db.ObjectStateManager.ChangeObjectState(menuitem, EntityState.Modified);
                    db.SaveChanges();

                }

                return RedirectToAction("Index");
            }

            return View(menuitem);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the MenuItems EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMenuItems(MenuItem menuItem)
 {
     base.AddObject("MenuItems", menuItem);
 }
 /// <summary>
 /// Create a new MenuItem object.
 /// </summary>
 /// <param name="menuID">Initial value of the MenuID property.</param>
 public static MenuItem CreateMenuItem(global::System.Int64 menuID)
 {
     MenuItem menuItem = new MenuItem();
     menuItem.MenuID = menuID;
     return menuItem;
 }