Exemplo n.º 1
0
        public async Task <IActionResult> PutCategory(int id, Category category)
        {
            if (id != category.CategoeryId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutPhotosAlbum(int id, PhotosAlbum photosAlbum)
        {
            if (id != photosAlbum.PhotoId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }