예제 #1
0
        public async Task <IActionResult> PutAssignCategories(int id, AssignCategories assignCategories)
        {
            if (id != assignCategories.AssignCategoryId)
            {
                return(BadRequest());
            }

            _context.Entry(assignCategories).State = EntityState.Modified;

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

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutIngredients(int id, Ingredients ingredients)
        {
            if (id != ingredients.IngredientID)
            {
                return(BadRequest());
            }

            _context.Entry(ingredients).State = EntityState.Modified;

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

            return(NoContent());
        }
예제 #3
0
        public async Task <IActionResult> PutRecipe(int id, Recipe recipe)
        {
            if (id != recipe.RecipeID)
            {
                return(BadRequest());
            }

            _context.Entry(recipe).State = EntityState.Modified;

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

            return(NoContent());
        }