public void SaveMenu(Menu menu)
 {
     if (menu.MenuID == 0)
     {
         context.Menus.Add(menu);
     }
     else
     {
         Menu dbEntry = context.Menus.Find(menu.MenuID);
         if (dbEntry != null)
         {
             dbEntry.Name = menu.Name;
             dbEntry.PDFData = menu.PDFData;
             dbEntry.PDFMimeType = menu.PDFMimeType;
         }
     }
     context.SaveChanges();
 }
 public ActionResult Edit(Menu menu, HttpPostedFileBase menuType)
 {
     if (ModelState.IsValid)
     {
         if (menuType != null)
         {
             menu.PDFMimeType = menuType.ContentType;
             menu.PDFData = new byte[menuType.ContentLength];
             menuType.InputStream.Read(menu.PDFData, 0, menuType.ContentLength);
         }
         menus.SaveMenu(menu);
         TempData["message"] = string.Format("Menu has been saved");
         return RedirectToAction("Index");
     }
     else
     {
         //there is something wrong with the data vaues
         return View();
     }
 }