| 12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using PowerMatterServiceReference;
- using Microsoft.AspNetCore.Cors;
- // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
- namespace Winsoft.GOV.PowerMatter.Restful.Controllers
- {
- [Route("api/[controller]")]
- [EnableCors("any")]
- public class BranchController : Controller
- {
- IPowerMettersService _powerMatterService;
- public BranchController(IPowerMettersService powerMatterService)
- {
- _powerMatterService = powerMatterService;
- }
- // GET: api/values
- [HttpGet("all/{c:int}")]
- [Produces(typeof(List<Branch>))]
- public async Task<IActionResult> Get(County c)
- {
- List<Branch> bs = await _powerMatterService.GetBranchsExAsync(c);
- if (bs == null)
- bs = new List<Branch>();
- return Ok(bs);
- }
- }
- }
|