public async Task <IActionResult> ResethMath(InBaseComponentView view) { try { var baseComponent = GlobalObjects.BaseComponents.FirstOrDefault(i => i.Id == view.BaseComponentId); if (baseComponent != null) { if (baseComponent.LifelengthCalculated != null) { baseComponent.LifelengthCalculated.Clear(); } else { baseComponent.LifelengthCalculated = new LifelengthCollection(baseComponent.ManufactureDate); } } return(Ok()); } catch (Exception e) { _logger.LogError(e.Message); return(BadRequest(new { Error = e.Message })); } }
public async Task <IActionResult> GetFlightLifelengthOnEndOfDayBaseComponent(InBaseComponentView view) { try { var res = await _calculator.GetFlightLifelengthOnEndOfDayBaseComponentAsync(view.BaseComponentId, view.EffectiveDate); return(Ok(res)); } catch (Exception e) { _logger.LogError(e.Message); return(BadRequest(new { Error = e.Message })); } }
public async Task <IActionResult> GetFlightLifelengthForPeriodWithRegimeBaseComponent(InBaseComponentView view) { try { var res = await _calculator.GetFlightLifelengthForPeriodBaseComponentAsync(view.BaseComponentId, view.FromDate, view.ToDate, view.FlightRegimeId); return(Ok(res)); } catch (Exception e) { _logger.LogError(e.Message); return(BadRequest(new { Error = e.Message })); } }