コード例 #1
0
        public async Task <IActionResult> PutMapProductImages([FromRoute] int id, [FromBody] MapProductImages mapProductImages)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mapProductImages.ImageId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PostMapProductImages([FromBody] MapProductImages mapProductImages)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MapProductImages.Add(mapProductImages);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMapProductImages", new { id = mapProductImages.ImageId }, mapProductImages));
        }