Esempio n. 1
0
        public async Task <IActionResult> PutCategory(int id, Model.Category category)
        {
            if (id != category.Id)
            {
                //return BadRequest();
            }

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

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

            return(null);
        }
Esempio n. 2
0
        public async Task <IActionResult> PutCousine(int id, Model.Cousine cousine)
        {
            if (id != cousine.Id)
            {
                return(null);
            }

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

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

            return(null);
        }
Esempio n. 3
0
        public async Task <IActionResult> PutDish(int id, Model.Dish dish)
        {
            if (id != dish.Id)
            {
                //
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!await DishExists(id))
                {
                    return(null);
                }
                else
                {
                    throw;
                }
            }
            return(null);
        }
Esempio n. 4
0
        public async Task <IActionResult> PutIngredients(int id, Model.Ingredient ingredients)
        {
            if (id != ingredients.Id)
            {
                return(null);
            }

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

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

            return(null);
        }