Exemplo n.º 1
0
        public async Task <ActionResult <HourDetail> > PostHourDetail(HourDetail hourDetail)
        {
            _context.HourDetails.Add(hourDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHourDetail", new { id = hourDetail.HourId }, hourDetail));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutHourDetail(int id, HourDetail hourDetail)
        {
            if (id != hourDetail.HourId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }