示例#1
0
        public async Task <IActionResult> PutNewsModel(int id, NewsModel newsModel)
        {
            if (id != newsModel.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <UserModel> PutUserModel(int id, UserModel userModel)
        {
            if (id != userModel.Id)
            {
            }

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


            await _context.SaveChangesAsync();


            return(userModel);
        }