/// <summary> /// Move a dining table from one table to another, combining tables if neccessary. /// </summary> /// <param name="managerId">Manager ID</param> /// <param name="serviceId">Target service ID</param> /// <param name="tableId">Target table ID</param> /// <param name="newTableNumber">New table number</param> /// <returns>A task that resolves to the new table ID upon completion.</returns> public async Task <string> MoveDiningTable(string managerId, string serviceId, string tableId, string newTableNumber) { // Ensure the manager has access to the given service. await _EnsureManagerCanAccessService(managerId, serviceId); // Lookup service information. var service = await _database.GetDiningServiceById(serviceId); // Throw an exception if the service is not active. if (!service.IsActive) { throw new ServiceIsNotActiveException(); } // Move the table to the new table number, combining tables if necessary. return(await _database.MoveDiningTable(serviceId, tableId, newTableNumber)); }