Пример #1
0
 //update rating of driver in order
 public IHttpActionResult UpdateRating(int IdOrder, int num)
 {
     try
     {
         OrdersFullDTO NewOrder = BL.OredersServis.Rating(IdOrder, num);
         if (NewOrder == null)
         {
             return(BadRequest("בעיה זמנית במערכת"));
         }
         return(Ok(NewOrder));
     }
     catch (Exception)
     {
         return(BadRequest("בעיה זמנית במערכת"));
     }
 }
Пример #2
0
 //update order by driver
 public IHttpActionResult UpdateOrder(OrdersFullDTO NewOrder)
 {
     try
     {
         NewOrder = BL.DriverToOrderService.UpdateOrder(NewOrder);
         if (NewOrder == null)
         {
             return(BadRequest("בעיה זמנית במערכת"));
         }
         return(Ok(NewOrder));
     }
     catch (Exception)
     {
         return(BadRequest("בעיה זמנית במערכת"));
     }
 }
Пример #3
0
 public IHttpActionResult Calculatingprice(OrdersFullDTO NewOrder)
 {
     try
     {
         NewOrder = BL.OredersServis.Calculatingprice(NewOrder);
         if (NewOrder == null)
         {
             return(BadRequest("בעיה זמנית במערכת"));
         }
         return(Ok(NewOrder));
     }
     catch (Exception)
     {
         return(BadRequest("בעיה זמנית במערכת"));
     }
 }
Пример #4
0
 //List of package types to order
 public IHttpActionResult GetPackagesToOrder(OrdersFullDTO Order)
 {
     try
     {
         List <packagesDTO> ListPackages = new List <packagesDTO>();
         ListPackages = BL.PackageToOrderService.PackagesToOrder(Order);
         if (ListPackages == null)
         {
             return(BadRequest("שגיאה זמנית במערכת"));
         }
         return(Ok(ListPackages));
     }
     catch (Exception)
     {
         return(BadRequest("שגיאה זמנית במערכת"));
     }
 }
Пример #5
0
 public IHttpActionResult PutUpdateDurationOrder(int DriverId)
 {
     try
     {
         OrdersFullDTO order = new OrdersFullDTO();
         order = BL.DriverService.update_duration_order(DriverId);
         if (order == null)
         {
             return(BadRequest("אחד מהנתונים שגויים"));
         }
         return(Ok(order));
     }
     catch (Exception)
     {
         return(BadRequest("אחד מהנתונים שגויים"));
     }
 }
Пример #6
0
 public IHttpActionResult PostDrivers(OrdersFullDTO Order)
 {
     try
     {
         int    Ord_Kod  = Order.Ord_Kod;
         string Source   = Order.Cust_sourceAddress;
         double Distance = (double)Order.DistanceDestination;
         List <PakegToOrderDTO> Packages = new List <PakegToOrderDTO>();
         Packages = Order.packages;
         List <DriversDTO> Drivers = new List <DriversDTO>();
         Drivers = DriverService.SuitableDrivers(Ord_Kod, Packages, Source, Distance);
         if (Drivers == null)
         {
             return(BadRequest("לא נמצאו נהגים מתאימים"));
         }
         return(Ok(Drivers));
     }
     catch (Exception)
     {
         return(BadRequest("לא נמצאו נהגים מתאימים"));
     }
 }
Пример #7
0
        public IHttpActionResult PostOrder(OrdersFullDTO PostOrder)
        {
            try
            {
                OrdersFullDTO newOrder = BL.OredersServis.AddOrder(PostOrder);
                if (newOrder == null)
                {
                    return(BadRequest("בעיה זמנית במערכת"));
                }
                var packages = BL.PackageToOrderService.CreatePackagesToOrder(newOrder);
                if (packages == null)
                {
                    return(BadRequest("בעיה זמנית במערכת"));
                }
                newOrder.packages = packages;

                return(Ok(newOrder));
            }
            catch (Exception)
            {
                return(BadRequest("בעיה זמנית במערכת"));
            }
        }