public ActionResult AddShipment( string sourceAddress, string sourceCity, string sourcePostalCode , string destinationAddress, string destinationCity, string destinationPostalCode , decimal weight) { var shipment = new ShipmentInfo { SourceAddress = new AddressInfo{Address1 = sourceAddress, City = sourceCity, ZipCode = sourcePostalCode}, DestinationAddress = new AddressInfo{Address1 = destinationAddress, City = destinationCity, ZipCode = destinationPostalCode}, Weight = weight }; var bll = new ShipmentBLL(); bll.AddShipment(shipment); return RedirectToAction("Index"); }
static void Main(string[] args) { ShipmentBLL shipBll = new ShipmentBLL(); DroneBLL droneBll = new DroneBLL(); ShipmentInfo shipment = new ShipmentInfo(); shipment.DestinationAddress = new AddressInfo(); shipment.DestinationAddress.Address1 = "335 Laird Road"; shipment.DestinationAddress.City = "Guelph"; shipment.DestinationAddress.Country = "Canada"; shipment.DestinationAddress.State = "Ontario"; shipment.DestinationAddress.ZipCode = "N1H 6J3"; shipment.DestinationAddress.Latitude = 43.50501M; shipment.DestinationAddress.Longitude = -80.26827M; shipment.Weight = 1M; shipment.Status = ShipmentStatus.AwaitingShipment; shipment.SourceAddress = new AddressInfo(); shipment.SourceAddress.Address1 = "8725 Yonge St"; shipment.SourceAddress.City = "Richmond Hill"; shipment.SourceAddress.Country = "Canada"; shipment.SourceAddress.State = "Ontario"; shipment.SourceAddress.ZipCode = "L4C 6Z1"; shipment.SourceAddress.Latitude = 43.84292M; shipment.SourceAddress.Longitude = -79.43053M; shipBll.AddShipment(shipment); DroneInfo drone = new DroneInfo(); drone.Latitude = 43.86071M; drone.Longitude = -79.37736M; drone.MaxWeight = 1000M; drone.Name = "DRONE 001"; drone.Status = DroneStatus.Available; droneBll.AddDrone(drone); shipBll.AssignDroneToShipment(drone.Id, shipment.Id); }