using BH.Signup.Core.Domain;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using System.Reflection;
using BH.Signup.Core.Models;
namespace Signup.Billhighway.Com.Controllers
{
///
///
///
public class ErrorsController : Controller
{
#region Constructors & Initialization
///
/// Initializes a new instance of the class.
///
/// The log service.
public ErrorsController(ILogService logService)
{
LogService = logService;
}
#endregion
#region Public Properties
/// Gets the log service.
/// The log service.
public ILogService LogService { get; private set; }
#endregion
/// Errors this instance.
///
public async Task Error(ErrorModel incomingModel)
{
var error = this.HttpContext.Features.Get();
int errorID = 0;
if (error != null)
{
errorID = (await LogService.Log(new LogRequest
{
Exception = error.Error,
Comment = "",
Method = this.GetType().GetMethod(nameof(Error)),
Path = "/Error",
UserID = 0
}));
}
var model = incomingModel ?? new ErrorModel();
model.RTEID = errorID;
return View(model);
}
}
}