private string DeleteBusTicket(string from, string to, string company, string dt) { var ticket = new BusTicket(from, to, company, dt); string result = AddDeleteTicket(ticket, false); if (result.Contains("deleted")) { busTicketsCount--; } return result; }
protected string CreateBusTicket(string from, string to, string company, string dateTime, string price) { var ticket = new BusTicket(from, to, company, dateTime, price); string key = ticket.TicketInformation; string result; if (DataBase.ContainsKey(key)) { result = "Duplicate ticket"; } else { DataBase.Add(key, ticket); string fromToKey = ticket.FromToKey; FromToDataBase.Add(fromToKey, ticket); DateTimeDataBase.Add(ticket.DateAndTime, ticket); result = "Ticket added"; } if (result.Contains("added")) { busTicketsCount++; } return result; }