示例#1
0
        public ActionResult LocationUpdate(int id, LocationV m)
        {
            var da = new CourierEntities();

            if (new Orders().FindOrder(id))
            {
                var update = new Courier.Models.Location();
                var curr   = update.AddCurrentLocation(id, m.CurrentLocation, m.CurrentLatitude, m.CurrentLogitude);
                var des    = update.UpdateDestination(id, m.Destination, m.DestinationLatitude, m.DestinationLogitude);
                var sou    = update.UpdateSource(id, m.Source, m.SourceLatitude, m.SourceLogitude);

                if (curr && des && sou)
                {
                    return(RedirectToAction("Order"));
                }
            }

            return(View());
        }
示例#2
0
        public ActionResult UpdateLocation(int id, LocationV m)
        {
            var checkID = Orders.CheckOrder(id);

            if (checkID)
            {
                var da = new CourierEntities();
                var q  = da.CurrentLocations.Where(a => a.OrderID == id).SingleOrDefault();
                if (q == null)
                {
                    //add new Locaction
                    var curr = new Courier.Models.Location().AddCurrentLocation(id, m.CurrentLocation, m.CurrentLatitude, m.CurrentLogitude);
                }
                else
                {
                    var updateLoc = new Courier.Models.Location().UpdateCurrentLocation(id, m.CurrentLocation, m.CurrentLatitude, m.CurrentLogitude);
                }
                return(RedirectToAction("Order"));
            }
            return(View(m));
        }