コード例 #1
0
        public async Task <IActionResult> PutMarriagetable(decimal id, Marriagetable marriagetable)
        {
            if (id != marriagetable.UId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <Marriagetable> > PostMarriagetable(Marriagetable marriagetable)
        {
            _context.Marriagetables.Add(marriagetable);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (MarriagetableExists((decimal)marriagetable.UId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetMarriagetable", new { id = marriagetable.UId }, marriagetable));
        }