public IActionResult Delete(int id, [FromQuery] int dayId) { ServiceResult result = PeriodService.DeletePeriod(id); if (result.Result == Result.NotFound) { return(NotFound()); } bool dayApproved = SchoolDayService.IsDayApproved(dayId); return(Ok(new { dayApproved })); }
public IActionResult Delete(int id) { ServiceResult serviceResult = SchoolDayService.DeleteDay(id); if (serviceResult.Result == Result.NotFound) { return(NotFound()); } if (serviceResult.Result != Result.OK) { return(BadRequest()); } return(Ok()); }
public IActionResult Approve(int id, [FromQuery] int dayId) { // TODO: maybe return some boolean result ServiceResult result = PeriodService.ApprovePeriod(id); if (result.Result == Result.NotFound) { return(NotFound()); } if (result.Result != Result.OK) { return(BadRequest()); } bool dayApproved = SchoolDayService.IsDayApproved(dayId); return(Ok(new { periodApproved = true, dayApproved, })); }