public async Task<IHttpActionResult> PutMenuCategory(int id, MenuCategory menuCategory)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != menuCategory.MenuCategoryId)
            {
                return BadRequest();
            }

            db.Entry(menuCategory).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MenuCategoryExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public async Task<IHttpActionResult> PostMenuCategory(MenuCategory menuCategory)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.MenuCategories.Add(menuCategory);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = menuCategory.MenuCategoryId }, menuCategory);
        }
 public HttpResponseMessage PostMenuCategory(MenuCategory menuCategory)
 {
     try
     {
         var MenuCategoryAdded = _repository.InsertMenuCategory(menuCategory);
         return Request.CreateResponse<MenuCategory>(HttpStatusCode.OK, MenuCategoryAdded);
     }
     catch (Exception ex)
     {
         return Request.CreateResponse(HttpStatusCode.NotFound, ex);
     }
 }
 public MenuCategory UpdateMenuCategory(MenuCategory menuCategory)
 {
     try
     {
         var MenuCategoryUpdate = _dBContext.MenuCategories.FirstOrDefault(aMenuCategory => aMenuCategory.MenuCategoryId == aMenuCategory.MenuCategoryId);
         MenuCategoryUpdate.CategoryName = menuCategory.CategoryName;
         //MenuCategoryUpdate.Orders = MenuCategory.Orders;
         //MenuCategoryUpdate.MenuCategories = MenuCategory.MenuCategories;
         _dBContext.SaveChanges();
         return menuCategory;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public MenuCategory InsertMenuCategory(MenuCategory menuCategory)
 {
     try
     {
         _dBContext.MenuCategories.Add(menuCategory);
         _dBContext.SaveChanges();
         return menuCategory;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void InsertMenuCategory(MenuCategory MenuCategory)
 {
     try
     {
         _dBContext.MenuCategories.Add(MenuCategory);
         _dBContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }