Esempio n. 1
0
        public async Task <IActionResult> PutLasku(int id, [FromForm] Lasku lasku)
        {
            if (id != lasku.LaskuId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutFile(int id, [FromForm] File file)
        {
            if (id != file.FileId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }