コード例 #1
0
        public async Task <ActionResult <Priscriptions> > PostPriscriptions(Priscriptions priscriptions)
        {
            _context.Priscriptions.Add(priscriptions);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPriscriptions", new { id = priscriptions.PriscriptionId }, priscriptions));
        }
コード例 #2
0
        public async Task <IActionResult> PutPriscriptions(int id, Priscriptions priscriptions)
        {
            if (id != priscriptions.PriscriptionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }