Skip to content

Instantly share code, notes, and snippets.

@fnbk
Last active September 18, 2022 14:50
Show Gist options
  • Save fnbk/0ee794e1dcf82e394e7abfae31ebe4e2 to your computer and use it in GitHub Desktop.
Save fnbk/0ee794e1dcf82e394e7abfae31ebe4e2 to your computer and use it in GitHub Desktop.
branching: if-else
private Job CreateJob(order order)
{
var errorMessage = ValidateComputer(order.ComputerName);
if (errorMessage != "")
{
return new Job()
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
orderId = order.Id,
Status = errorMessage,
};
}
var computer = GetComputer(order.ComputerName, order.CustomerId);
computer.CustomerId = GetCustomerId(order.CustomerId, computer.CustomerId);
var serverAddress = GetServerAddress(order.ComputerName, computer.CustomerId);
var deploymentType = GetDeploymentType(order.MaterialNumber, computer.CustomerId);
return new Job()
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
OrderId = order.Id,
JobActions = CreateJobActions(deploymentType, order, serverAddress, computer),
Status = "created",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment