コード例 #1
0
        public async Task <IActionResult> PutGsUserSetting(int id, GsUserSetting gsUserSetting)
        {
            if (id != gsUserSetting.UserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <GsUserSetting> > PostGsUserSetting(GsUserSetting gsUserSetting)
        {
            _context.GsUserSettings.Add(gsUserSetting);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (GsUserSettingExists(gsUserSetting.UserId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetGsUserSetting", new { id = gsUserSetting.UserId }, gsUserSetting));
        }