AddHobbiController.cs 506 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 AddHobbiController : ControllerBase
  8. {
  9. ApplicationContext db = new ApplicationContext();
  10. [HttpPost]
  11. public IActionResult Index(Hobbies hobbi)
  12. {
  13. db.tbHobbies.Add(hobbi);
  14. db.SaveChanges();
  15. return Ok();
  16. }
  17. }
  18. }