FIC_Solar/SolarPower/Controllers/ExceptionRecordController.cs
2021-09-02 14:30:46 +08:00

56 lines
1.5 KiB
C#

using Microsoft.AspNetCore.Mvc;
using SolarPower.Models;
using SolarPower.Models.PowerStation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SolarPower.Controllers
{
public class ExceptionRecordController : MyBaseController<ExceptionRecordController>
{
public IActionResult Index()
{
return View();
}
public ApiResult<List<MyCity>> GetMyCities()
{
ApiResult<List<MyCity>> apiResult = new ApiResult<List<MyCity>>();
try
{
apiResult.Code = "0000";
apiResult.Data = myPowerStationService.GetMyCities(myUser);
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = exception.ToString();
}
return apiResult;
}
public ApiResult<List<PowerStation>> GetPowerStationByFilter(List<int> cityIds)
{
ApiResult<List<PowerStation>> apiResult = new ApiResult<List<PowerStation>>();
try
{
var myPowerStations = myPowerStationService.GetMyPowerStations(myUser, cityIds);
apiResult.Code = "0000";
apiResult.Data = myPowerStations;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = exception.ToString();
}
return apiResult;
}
}
}