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