public bool AddSale(List <Sale> sales)
        {
            bool isAdded = false;

            foreach (Sale sale in sales)
            {
                isAdded = _saleRepository.AddSale(sale);
            }
            return(isAdded);
        }
Beispiel #2
0
        public static string PrepareBuyResponse(string buyRequest)
        {
            string[] buyParams = buyRequest.Split('?');
            Console.WriteLine(" Buy credentials: ({0})", buyRequest);

            SaleRepository saleRepository = new SaleRepository();

            int trainId = Convert.ToInt32(buyParams[(int)BuyParam.RouteId]);
            int userId  = Convert.ToInt32(buyParams[(int)BuyParam.UserId]);

            string from_station = buyParams[(int)BuyParam.From];
            string to_station   = buyParams[(int)BuyParam.To];

            int    amount      = Convert.ToInt16(buyParams[(int)BuyParam.Amount]);
            string ticket_type = buyParams[(int)BuyParam.TicketType];

            bool result = saleRepository.AddSale(from_station, to_station, trainId, userId, (short)amount, ticket_type);

            return(result.ToString());
        }
Beispiel #3
0
 public long AddSale(SaleObject sale, out string invoiceRef)
 {
     return(_saleRepository.AddSale(sale, out invoiceRef));
 }