public async Task <IActionResult> Post([FromBody] RestrictionsModel model) { if (BUS_Controls.Controls.ChangeRestriction(model)) { return(new JsonResult(new ApiResponse <object>("Ok"))); } else { return(new JsonResult(new ApiResponse <object>(200, "cant change"))); } }
public async Task <IActionResult> Get() { RestrictionsModel restriction = BUS_Controls.Controls.GetRestriction(); if (restriction != null) { return(new JsonResult(new ApiResponse <object>(restriction))); } else { return(new JsonResult(new ApiResponse <object>(200, "found nothing"))); } }
private async Task LoadRestrictions() { Response <RestrictionsModel> response = await APIHelper.Instance.Get <Response <RestrictionsModel> >(ApiRoutes.Restriction.Get); if (response.IsSuccess) { RestrictionsModel result = response.Result; MinFlightTime = new DateTime() + result.MinFlightTime; MaxTransit = result.MaxTransit; MinTransitTime = new DateTime() + result.MinTransitTime; MaxTransitTime = new DateTime() + result.MaxTransitTime; LatestBookingTime = result.LatestBookingTime; LatestCancelingTime = result.LatestCancelingTime; } }
public async Task Save() { RestrictionsModel restrictionsModel = new RestrictionsModel { LatestBookingTime = this.LatestBookingTime, LatestCancelingTime = this.LatestCancelingTime, MaxTransit = this.MaxTransit, MaxTransitTime = this.MaxTransitTime.TimeOfDay, MinFlightTime = this.MinFlightTime.TimeOfDay, MinTransitTime = this.MinTransitTime.TimeOfDay }; await APIHelper.Instance.Post <RestrictionsModel>(ApiRoutes.Restriction.Post, restrictionsModel); Editting = false; Reset(); }