コード例 #1
0
        public async Task <IActionResult> UpdateMenuItemAsync(long id, [FromBody] ItemModel model)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, GetErrorList(ModelState)));
            }

            MenuItems existingMenuItem;

            try
            {
                People currentUser = GetCurrentUser();
                existingMenuItem = await Services.UpdateMenuItemAsync(currentUser.ThePersonAsEmployer.Id,
                                                                      model.RestaurantId, id, model.GetItemNameDictionary(),
                                                                      model.GetItemDescriptionDictionary(), model.GetItemWarningsDictionary(),
                                                                      model.GetItemPriceDictionary());
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, GetErrorList(ex)));
            }

            return(Ok(existingMenuItem));
        }