예제 #1
0
        public async Task <IActionResult> PutDebtCard([FromRoute] int id, [FromBody] DebtCard DebtCard)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != DebtCard.ID)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();

                return(Accepted(DebtCard));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DebtCardExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }
예제 #2
0
        public async Task <IActionResult> PutLibrarySystem([FromRoute] int id, [FromBody] LibrarySystem LibrarySystem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != LibrarySystem.ID)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();

                return(Accepted(LibrarySystem));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LibrarySystemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }