Esempio n. 1
0
        public async Task<ActionResult<KalaPicture>> PostKalaPicture(KalaPicture kalaPicture)
        {
            _IKalaPicture.Add(kalaPicture);
            await _IKalaPicture.SaveAsync();

            return CreatedAtAction("GetKalaPicture", new { id = kalaPicture.KalaPictureId }, kalaPicture);
        }
Esempio n. 2
0
        public async Task<IActionResult> PutKalaPicture(int id, KalaPicture kalaPicture)
        {
            if (id != kalaPicture.KalaPictureId)
            {
                return BadRequest();
            }

            _IKalaPicture.Update(kalaPicture);

            try
            {
                await _IKalaPicture.SaveAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KalaPictureExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return NoContent();
        }