示例#1
0
        public async Task <IActionResult> PutSocioModel(string id, SocioModel socioModel)
        {
            if (id != socioModel.credentialID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <SocioModel> > PostSocioModel(SocioModel socioModel)
        {
            _context.SocioModels.Add(socioModel);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (SocioModelExists(socioModel.credentialID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetSocioModel", new { id = socioModel.credentialID }, socioModel));
        }