Exemple #1
0
        public async Task <ActionResult <AgesInfo> > PostAgesInfo(AgesInfo agesInfo)
        {
            _context.AgesInfos.Add(agesInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAgesInfo", new { id = agesInfo.Id }, agesInfo));
        }
Exemple #2
0
        public async Task <IActionResult> PutAgesInfo(long id, AgesInfo agesInfo)
        {
            if (id != agesInfo.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }