Update
As I said in my comments, complex logic doesn't really change anything.
You want to process a disputed order. There are multiple ways of doing that. Disputed order type can be EnumEnum
:
public void ProcessDisputedOrder(DisputedOrder order)
{
switch (order.Type)
{
case : DisputedOrderType.Canceled:
var strategy = new StrategyForDisputedCanceledOrder();
strategy.Process(order);
break;
case : DisputedOrderType.LessThan7Days:
var strategy = new DifferentStrategy();
strategy.Process(order);
break;
default:
throw new NotImplementedException("");
}
}
There are many ways of doing this. You can have inheritance hierarchy of OrderOrder
, DisputedOrderDisputedOrder
, DisputedOrderLessThan7DaysDisputedOrderLessThan7Days
, DisputedOrderCanceledDisputedOrderCanceled
, etc. This is not nice, but it would also work.
Original Answer (no, no longer relevant as I thought you were after something simpler):
CheckBannedIP(login.IP);
CheckLoginTrial(login);
Authenticate(login.Username, login.Password);
public void CheckBannedIP(string ip)
{
// If banned then re-direct, else do nothing.
}
public void CheckLoginTrial(LoginAttempt login)
{
// If exceeded trials, then inform user, else do nothing
}
public void Authenticate(string username, string password)
{
// Attempt to authenticate. On success redirect, else catch any errors and inform the user.
}