public async Task <IActionResult> CheckOutGamingPatron([FromRoute] string serviceId, [FromRoute] string patronId) { // Pull manager ID from the HTTP context. string managerId = HttpContext.User.Identity.Name; try { // Checkout the gaming patron. await _managerService.CheckOutGamingPatron(managerId, serviceId, patronId); // Return an empty OK status. return(Ok()); } catch (PatronNotFoundException e) { // Error: Patron specified not found. _logger.LogInformation(e, "Could not find specified gaming patron for update. [mId: {managerId}, sId: {serviceId}, pId: {patronId}]", managerId, serviceId, patronId); return(BadRequest(APIError.PatronNotFound())); } catch (NoAccessException e) { // Error: Manager does not have sufficient permissions to checkout the gaming patron. _logger.LogInformation(e, "Manager was denied access to checkout gaming patron. [mId: {managerId}, sId: {serviceId}]", managerId, serviceId); return(BadRequest(APIError.NoAccess())); } catch (Exception e) { // Error: Unknown error. _logger.LogError(e, "Failed to checkout gaming patron"); return(BadRequest(APIError.UnknownError())); } }
public async Task <IActionResult> UpdateDiningPatron( [FromRoute] string serviceId, [FromRoute] string tableId, [FromRoute] string checkInId, [FromRoute] string patronId, [FromBody] DiningPatronUpdateRequest update ) { // Pull manager ID from the HTTP context. string managerId = HttpContext.User.Identity.Name; try { // Update the dining patron with new information. await _managerService.UpdateDiningPatron(managerId, serviceId, tableId, checkInId, patronId, update); // 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 to update patron. [service: {serviceId}, sitting: {tableId}]", serviceId, tableId); return(BadRequest(APIError.TableNotFound())); } catch (CheckInNotFoundExcption e) { // Error: Check-in specified could not be found. _logger.LogInformation(e, "Could not find specified dining check-in to update patron. [service: {serviceId}, sitting: {tableId}, checkIn: {checkInId}]", serviceId, tableId, checkInId); return(BadRequest(APIError.CheckInNotFound())); } catch (PatronNotFoundException e) { // Error: Patron specified for update does not exist. _logger.LogInformation(e, "Could not find specified dining patron for update. [mId: {managerId}, sId: {serviceId}, pId: {patronId}]", managerId, serviceId, patronId); return(BadRequest(APIError.PatronNotFound())); } catch (NoAccessException e) { // Error: Manager does not have sufficient access to update the dining patron. _logger.LogInformation(e, "Manager was denied access to update dining patron. [mId: {managerId}, sId: {serviceId}]", managerId, serviceId); return(BadRequest(APIError.NoAccess())); } catch (Exception e) { // Error: Unknown error. _logger.LogError(e, "Failed to update dining patron"); return(BadRequest(APIError.UnknownError())); } }