Controllers: add try/catch to CommonController.cs
This commit is contained in:
parent
b42a9bb284
commit
564ea80ef7
@ -3,6 +3,7 @@ using ELT.Client.Models.Common;
|
|||||||
using ELTKasko;
|
using ELTKasko;
|
||||||
using ELTOsago;
|
using ELTOsago;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using AuthInfo = ELTOsago.AuthInfo;
|
||||||
using EltKaskoSoap = ELTKasko.EltSoap;
|
using EltKaskoSoap = ELTKasko.EltSoap;
|
||||||
using ELTOsagoSoap = ELTOsago.EltSoap;
|
using ELTOsagoSoap = ELTOsago.EltSoap;
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ public class CommonController : ControllerBase
|
|||||||
|
|
||||||
[HttpPost("get-kasko-calculation")]
|
[HttpPost("get-kasko-calculation")]
|
||||||
public ActionResult<KASKOCalculationResult> GetKaskoCalculation([FromBody] GetKaskoCalculationInput data)
|
public ActionResult<KASKOCalculationResult> GetKaskoCalculation([FromBody] GetKaskoCalculationInput data)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var preRequestData = this.GetPreRequestData(data.Preparams);
|
var preRequestData = this.GetPreRequestData(data.Preparams);
|
||||||
|
|
||||||
@ -79,9 +82,16 @@ public class CommonController : ControllerBase
|
|||||||
|
|
||||||
return Ok(res);
|
return Ok(res);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return StatusCode(500, e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost("get-osago-calculation")]
|
[HttpPost("get-osago-calculation")]
|
||||||
public ActionResult<OSAGOFullCalculationResponse> GetOsagoCalculation([FromBody] GetOsagoCalculationInput data)
|
public ActionResult<OSAGOFullCalculationResponse> GetOsagoCalculation([FromBody] GetOsagoCalculationInput data)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var prerequestData = this.GetPreRequestData(data.Preparams);
|
var prerequestData = this.GetPreRequestData(data.Preparams);
|
||||||
|
|
||||||
@ -90,7 +100,7 @@ public class CommonController : ControllerBase
|
|||||||
request.CarInfo.Mark = prerequestData.Brand;
|
request.CarInfo.Mark = prerequestData.Brand;
|
||||||
request.CarInfo.Model = prerequestData.Model;
|
request.CarInfo.Model = prerequestData.Model;
|
||||||
|
|
||||||
request.AuthInfo = new ELTOsago.AuthInfo
|
request.AuthInfo = new AuthInfo
|
||||||
{
|
{
|
||||||
Login = _login,
|
Login = _login,
|
||||||
Password = _password
|
Password = _password
|
||||||
@ -107,4 +117,9 @@ public class CommonController : ControllerBase
|
|||||||
|
|
||||||
return Ok(res);
|
return Ok(res);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return StatusCode(500, e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user