Esempio n. 1
0
        public async Task <IActionResult> PutFaktura([FromRoute] int id, [FromBody] Faktura faktura)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != faktura.Faktura_Nummer)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutLeverendør([FromRoute] int id, [FromBody] Leverendør leverendør)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != leverendør.Id)
            {
                return(BadRequest());
            }

            _dbNorge.Entry(leverendør).State = EntityState.Modified;

            try
            {
                await _dbNorge.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LeverendørExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }