Exemplo n.º 1
0
        public static DbGeography GetDirectionMovement(DbGeography current, Orders orders)
        {
            if (orders.directions == null)
            {
                orders.directions = OrdersParser.ParseDirections(GetDirections(orders.location.Latitude.Value, orders.location.Longitude.Value, current.Latitude.Value, current.Longitude.Value).Result);
            }

            string directions = OrdersParser.UpdateNextLoc(orders.directions);

            using (var db = new MinionWarsEntities())
            {
                orders.directions = directions;

                db.Orders.Attach(orders);
                db.Entry(orders).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

            return(OrdersParser.GetNextLoc(directions));
        }
Exemplo n.º 2
0
        public static DbGeography GetCaravanDirectionMovement(Caravan car, DbGeography destination)
        {
            if (car.directions == null)
            {
                car.directions = OrdersParser.ParseDirections(GetDirections(destination.Latitude.Value, destination.Longitude.Value, car.location.Latitude.Value, car.location.Longitude.Value).Result);
            }

            string directions = OrdersParser.UpdateNextLoc(car.directions);

            using (var db = new MinionWarsEntities())
            {
                car.directions = directions;

                db.Caravan.Attach(car);
                db.Entry(car).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

            return(OrdersParser.GetNextLoc(directions));
        }
Exemplo n.º 3
0
 public static string GetCaravanDirections(DbGeography current, DbGeography destination)
 {
     return(OrdersParser.ParseDirections(GetDirections(destination.Latitude.Value, destination.Longitude.Value, current.Latitude.Value, current.Longitude.Value).Result));
 }
Exemplo n.º 4
0
 public static string GetNewDirections(DbGeography current, Orders orders)
 {
     return(OrdersParser.ParseDirections(GetDirections(orders.location.Latitude.Value, orders.location.Longitude.Value, current.Latitude.Value, current.Longitude.Value).Result));
 }