コード例 #1
0
        public async Task <IActionResult> PutCumulativePoints(string id, CumulativePoints cumulativePoints)
        {
            if (id != cumulativePoints.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <CumulativePoints> > PostCumulativePoints(CumulativePoints cumulativePoints)
        {
            _context.CumulativePoints.Add(cumulativePoints);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CumulativePointsExists(cumulativePoints.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetCumulativePoints", new { id = cumulativePoints.Id }, cumulativePoints));
        }