Guest User

Untitled

a guest
Aug 18th, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. using System;
  2. using System.Threading.Tasks;
  3. using Abp.AutoMapper;
  4. using MyExchange.Api.Dto.PairInfoOnExchange;
  5. using MyExchange.Api.Services.Crud;
  6.  
  7. namespace MyExchange.Web.Controllers
  8. {
  9. [Route("api/[controller]")]
  10. public class PairInfoOnExchangeController : MyExchangeControllerBase<IPairInfoOnExchangeCrudAppService>
  11. {
  12. public PairInfoOnExchangeController(IPairInfoOnExchangeCrudAppService service) : base(service)
  13. {
  14.  
  15. }
  16.  
  17. [HttpGet]
  18. public async Task<PagedResultDto<PairInfoOnExchangeDto>> Get()
  19. {
  20.  
  21. return await Service.GetAll(new PairInfoOnExchangePagedResultRequestDto());
  22.  
  23. }
  24.  
  25. [HttpGet("{id}")]
  26. public async Task<PairInfoOnExchangeDto> Get([FromRoute]Guid id)
  27. {
  28. return await Service.Get(id);
  29. }
  30.  
  31. [HttpPost]
  32. public async Task<PairInfoOnExchangeDto> Post([FromBody] CreatePairInfoOnExchangeDto input)
  33. {
  34. var dto = await Service.Create(input.MapTo<PairInfoOnExchangeDto>());
  35.  
  36. return dto;
  37. }
  38.  
  39. [HttpPut("{id}")]
  40. public async Task<PairInfoOnExchangeDto> Put([FromRoute] Guid id,[FromBody] PairInfoOnExchangeDto input)
  41. {
  42.  
  43. var dto = await Service.Get(id);
  44.  
  45. dto = await Service.Update(ObjectMapper.Map(input, dto));
  46.  
  47. return dto;
  48. }
  49.  
  50. [HttpDelete("{id}")]
  51. public async Task Delete([FromRoute] Guid id)
  52. {
  53. await Service.Delete(id);
  54. }
  55. }
  56. }
Add Comment
Please, Sign In to add comment