public async Task <IActionResult> CloseDiningTable([FromRoute] string serviceId, [FromRoute] string tableId) { // Pull manager ID from the HTTP context string managerId = HttpContext.User.Identity.Name; try { // Close the dining table. await _managerService.CloseDiningTable(managerId, serviceId, tableId); // Return an empty OK status. return(Ok()); } catch (TableNotFoundException e) { // Error: Table specified could not be found. _logger.LogInformation(e, "Could not find specified dining sitting. [service: {serviceId}, sitting: {tableId}]", serviceId, tableId); return(BadRequest(APIError.TableNotFound())); } catch (NoAccessException e) { // Error: Manager does not have sufficient permission to close the requested dining table. _logger.LogInformation(e, "Manager was denied access to close dining table. [mId: {managerId}, sId: {serviceId}]", managerId, serviceId); return(BadRequest(APIError.NoAccess())); } catch (Exception e) { // Error: Unknown error. _logger.LogError(e, "Failed to close dining table"); return(BadRequest(APIError.UnknownError())); } }