예제 #1
0
        public async Task <ActionResult <Vask> > PostVask(Vask vask)
        {
            _context.vaskeTabell.Add(vask);
            await _context.SaveChangesAsync();

            return(vask);
            //return CreatedAtAction(nameof(GetVask), new { id = vask.vaskID }, vask);
        }
예제 #2
0
        public async Task <ActionResult <Vask> > UpdateVask(int id, [FromBody] Vask vask)
        {
            var exists = await _context.vaskeTabell.AnyAsync(v => v.vaskID == id);

            if (!exists)
            {
                Console.Beep();
                return(NotFound());
            }

            _context.vaskeTabell.Update(vask);

            await _context.SaveChangesAsync();

            return(Ok());
        }