コード例 #1
0
        public async Task <ActionResult <AnnualOrderDetail> > PostAnnualOrderDetail(AnnualOrderDetail annualOrderDetail)
        {
            _context.AnnualOrderDetail.Add(annualOrderDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAnnualOrderDetail", new { id = annualOrderDetail.AnnualOrderDetailId }, annualOrderDetail));
        }
コード例 #2
0
        public async Task <IActionResult> PutAnnualOrderDetail(int id, AnnualOrderDetail annualOrderDetail)
        {
            if (id != annualOrderDetail.AnnualOrderDetailId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }