| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using PowerMatterServiceReference;
- using Microsoft.AspNetCore.Cors;
- namespace Winsoft.GOV.PowerMatter.Restful.Controllers
- {
- [Route("api/[controller]")]
- [EnableCors("any")]
- public class PowerMatterController : Controller
- {
- IPowerMettersService _powerMatterService;
- public PowerMatterController(IPowerMettersService powerMatterService)
- {
- _powerMatterService = powerMatterService;
- }
- [HttpGet("getByBranch/{c:int}/{guid}")]
- [Produces(typeof(List<PowerMattersBase>))]
- public async Task<IActionResult> Get(County c, string guid)
- {
- List<PowerMattersBase> ps = await _powerMatterService.GetPowerMattersByBranchGuidExAsync(guid, c);
- if (ps == null)
- ps = new List<PowerMattersBase>();
- return Ok(ps);
- }
- [HttpGet("detail/{c:int}/{ql_inner_code}")]
- [Produces(typeof(PowerMattersDetail))]
- public async Task<IActionResult> GetDetail(County c, string ql_inner_code)
- {
- PowerMattersDetail pd = await _powerMatterService.GetPowerMattersDetailByRowIDExAsync(ql_inner_code, c);
- if (pd == null)
- return BadRequest();
- return Ok(pd);
- }
- }
- }
|