1234567891011121314151617181920212223 |
- using BelovAPI.BaseConnection;
- using BelovAPI.ModelBase;
- using Microsoft.AspNetCore.Mvc;
- namespace BelovAPI.Controllers
- {
- [Route("api/[controller]")]
- [ApiController]
- [ApiExplorerSettings(GroupName = "Действия с пользователем")]
- public class ChangeUser : Controller
- {
- ApplicationContext db = new ApplicationContext();
- [HttpPut]
- public IActionResult Index(User NewUser, int id)
- {
- User user = db.User.FirstOrDefault(x => x.Id == id);
- user.nameUser = NewUser.nameUser;
- user.Age = NewUser.Age;
- db.SaveChanges();
- return Ok(user);
- }
- }
- }
|