AddUserController.cs 519 B

12345678910111213141516171819
  1. using Microsoft.AspNetCore.Mvc;
  2. namespace API_development.Controllers
  3. {
  4. [Route("api/[controller]")]
  5. [ApiController]
  6. [ApiExplorerSettings(GroupName = "Действия с пользователем")]
  7. public class AddUserController : ControllerBase
  8. {
  9. ApplicationContext db = new ApplicationContext();
  10. [HttpPost]
  11. public IActionResult Index(Users user)
  12. {
  13. db.tbUsers.Add(user);
  14. db.SaveChanges();
  15. return Ok(user);
  16. }
  17. }
  18. }