Esempio n. 1
0
        public async Task <IActionResult> PutDateYearoff(int id, DateYearoff dateYearoff)
        {
            if (id != dateYearoff.DateId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <DateYearoff> > PostDateYearoff(DateYearoff dateYearoff)
        {
            _context.DateYearoff.Add(dateYearoff);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (DateYearoffExists(dateYearoff.DateId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetDateYearoff", new { id = dateYearoff.DateId }, dateYearoff));
        }