Пример #1
0
        public async Task <IActionResult> PostGrossInternationalReserve([FromBody] GrossInternationalReserve grossInternationalReserve)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.GrossInternationalReserves.Add(grossInternationalReserve);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGrossInternationalReserve", new { id = grossInternationalReserve.ID }, grossInternationalReserve));
        }
Пример #2
0
        public async Task <IActionResult> PutGrossInternationalReserve([FromRoute] int id, [FromBody] GrossInternationalReserve grossInternationalReserve)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }