Esempio n. 1
0
        public async Task <ActionResult <LevyStatement> > PostLevyStatement(LevyStatement levyStatement)
        {
            _context.LevyStatements.Add(levyStatement);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetLevyStatement), new { id = levyStatement.Id }, levyStatement));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutLevyStatement(long id, LevyStatement levyStatement)
        {
            if (id != levyStatement.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }