コード例 #1
0
        public async Task <IActionResult> PutEholidays(long id, Eholidays eholidays)
        {
            if (id != eholidays.EholidaysId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <Eholidays> > PostEholidays(Eholidays eholidays)
        {
            _context.Eholidays.Add(eholidays);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EholidaysExists(eholidays.EholidaysId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEholidays", new { id = eholidays.EholidaysId }, eholidays));
        }