private void PushModel <T>(T model, bool creating, Action <bool, T> nextAction, Action <bool> curAction) { if (!validator.IsValid(model, curAction, creating)) { return; } nextAction(creating, model); inAppBehavior.Menu(); }
private void OrderByOrQuit(bool asc) { Console.Write("Choose option: "); int lastPropIndex = propIndex; int.TryParse(Console.ReadLine().Trim(), out propIndex); if (propIndex < 1 || propIndex > optionsLength + 2) { Console.WriteLine("You entered wrong value"); inAppBehavior.ContinueOrQuit(OrderByOrQuit, inAppBehavior.Menu); return; } if (propIndex == optionsLength + 2) { inAppBehavior.Menu(); return; } if (propIndex == optionsLength + 1) { searcher.Search(); action(orderBy, lastPropIndex); return; } asc = lastPropIndex == propIndex ? !asc : true; orderBy = properties[propIndex - 1].Name; if (!asc) { orderBy += " desc"; } action(orderBy, propIndex); }