DogController.cs 818 B

12345678910111213141516171819202122232425262728293031323334
  1. using androidAPI.BaseConneckion;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Microsoft.AspNetCore.Http;
  4. using Google;
  5. using androidAPI.ModelBase;
  6. using System.Reflection.Metadata.Ecma335;
  7. namespace androidAPI.Controllers
  8. {
  9. [Route("api/[controller]")]
  10. [ApiController]
  11. [ApiExplorerSettings(GroupName = "Узнаем о собачках")]
  12. public class DogController : ControllerBase
  13. {
  14. MainTheApplication oo = new MainTheApplication();
  15. //[Route("api/[controller]")]
  16. [HttpGet]
  17. public IActionResult Index() => Ok(oo.DogiTut.ToList());
  18. //[Route("api/[controller]")]
  19. [HttpPost]
  20. public IActionResult Index(Inform inform)
  21. {
  22. oo.Add(inform);
  23. oo.SaveChanges();
  24. return Ok(inform);
  25. }
  26. }
  27. }