public IHttpActionResult Post([FromBody] CarInventoryModel newCarType) { BOLCarInventory RetrievedCarInventory = GetCarInventoryFilter.RetrieveCarInventory(newCarType); BOLCarInventory add = RentCarsInVehicleInventory.AddCarTo_db(RetrievedCarInventory); return(Ok(add)); }
public static List <OrderModel> GetListOrders() { List <BOLOrder> userorsers = RentOrder.GetUserFrom_db(); try { List <OrderModel> returneduserorsers = new List <OrderModel>(); foreach (var item in userorsers) { returneduserorsers.Add(new OrderModel { StartDate = item.StartDate, ReturnDate = item.ReturnDate, UserName = RentUser.GetUserName(item.UserID), VehicleNumber = RentCarsInVehicleInventory.GetVehicleNumber(item.VehiclesID), ActualReturnDate = item.ActualReturnDate }); } return(returneduserorsers); } catch { } return(null); }
public IHttpActionResult Put([FromBody] List <CarInventoryModel> Car) { BOLCarInventory RetrievedCarInventory0 = GetCarInventoryFilter.RetrieveCarInventory(Car[0]); BOLCarInventory RetrievedCarInventory1 = GetCarInventoryFilter.RetrieveCarInventory(Car[1]); RentCarsInVehicleInventory.UpDataTo_db(RetrievedCarInventory0, RetrievedCarInventory1); return(Ok()); }
public IHttpActionResult returnCar([FromBody] OrderModel order) { BOLOrder RetrievedOrder = GetOrdersFilter.RetrieveOrder(order); BOLOrder getOrder = RentOrder.UpDataTo_db(RetrievedOrder); var a = (getOrder.ActualReturnDate.Value - getOrder.StartDate.Date).TotalDays; int CarsTypeID = RentCarsInVehicleInventory.GetCarsTypeID(getOrder.VehiclesID); decimal carPriceForDay = RentTypeOfCars.getDaylyCost(CarsTypeID); return(Ok(carPriceForDay)); }
internal static BOLOrder RetrieveOrder(string userName, int carNumber, DateTime start) { try { BOLOrder newOrder = new BOLOrder(); newOrder.StartDate = start; newOrder.UserID = RentUser.GetUserid(userName); newOrder.VehiclesID = RentCarsInVehicleInventory.GetVehicleid(carNumber); return(newOrder); } catch { return(null); } }
public IHttpActionResult GetFilteredCars(string Company, string Gear, string Model, string openText, DateTime?Year) { var baseUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority); List <BOLCarInventory> value = RentCarsInVehicleInventory.GetCarFrom_db(); foreach (var item in value) { item.VehiclePic = baseUrl + @"/image/" + item.VehiclePic; } List <CarInventoryModel> carList = GetCarInventoryFilter.ListRetrieveFilteredCarInventory(value, Company, Gear, Model, openText, Year); return(Ok(carList)); }
// GET: api/CarInventory public IHttpActionResult Get(int from, int to) { var baseUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority); List <BOLCarInventory> value = RentCarsInVehicleInventory.GetCarFrom_db(); foreach (var item in value) { item.VehiclePic = baseUrl + @"/image/" + item.VehiclePic; } List <CarInventoryModel> carList = GetCarInventoryFilter.ListRetrieveCarInventory(value, from, to); return(Ok(carList)); }
public IHttpActionResult Get(int carNumber) { var baseUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority); BOLCarInventory value = RentCarsInVehicleInventory.GetCarFrom_db(carNumber); if (value != null) { value.VehiclePic = baseUrl + @"/image/" + value.VehiclePic; CarInventoryModel carList = GetCarInventoryFilter.ReturnCarInventory(value); return(Ok(carList)); } return(null); }
public static BOLOrder RetrieveOrder(OrderModel orderModel) { try { BOLOrder newOrder = new BOLOrder(); newOrder.StartDate = orderModel.StartDate; newOrder.ReturnDate = orderModel.ReturnDate; newOrder.UserID = RentUser.GetUserid(orderModel.UserName); newOrder.VehiclesID = RentCarsInVehicleInventory.GetVehicleid(orderModel.VehicleNumber); newOrder.ActualReturnDate = orderModel.ActualReturnDate; return(newOrder); } catch { return(null); } }
public static List <BOLOrder> RetrievelistOrder(List <OrderModel> orderModel) { try { List <BOLOrder> newOrder = new List <BOLOrder>(); foreach (var item in orderModel) { newOrder.Add(new BOLOrder { StartDate = item.StartDate, ReturnDate = item.ReturnDate, UserID = RentUser.GetUserid(item.UserName), VehiclesID = RentCarsInVehicleInventory.GetVehicleid(item.VehicleNumber), ActualReturnDate = item.ActualReturnDate }); } return(newOrder); } catch { return(null); } }
public static OrderModel PostOrders(OrderModel Order) { try { BOLOrder newOrder = new BOLOrder(); newOrder.StartDate = Order.StartDate; newOrder.ReturnDate = Order.ReturnDate; newOrder.UserID = RentUser.GetUserid(Order.UserName); newOrder.VehiclesID = RentCarsInVehicleInventory.GetVehicleid(Order.VehicleNumber); newOrder.ActualReturnDate = Order.ActualReturnDate; if (RentOrder.AddBranchTo_db(newOrder)) { return(Order); } return(null); } catch { return(null); } }
public static List <OrderModel> GetUserOrdesrByUserName(string userName) { try { List <OrderModel> orderList = new List <OrderModel>(); List <BOLOrder> orders = RentOrder.GetUsersOrdesrByUserName(userName); foreach (var item in orders) { orderList.Add(new OrderModel { StartDate = item.StartDate, ReturnDate = item.ReturnDate, UserName = userName, VehicleNumber = RentCarsInVehicleInventory.GetVehicleNumber(item.VehiclesID), ActualReturnDate = item.ActualReturnDate }); } return(orderList); } catch { return(null); } }
public IHttpActionResult Get(string orderlist) { var baseUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority); JObject json = JObject.Parse(orderlist); List <OrderModel> orderList = new List <OrderModel>(); foreach (var item in json) { orderList = new JavaScriptSerializer().Deserialize <List <OrderModel> >(item.Value.ToString()); } List <BOLOrder> convertedOrderList = GetOrdersFilter.RetrievelistOrder(orderList); List <BOLCarInventory> value = RentCarsInVehicleInventory.GetCarFrom_db(convertedOrderList); foreach (var item in value) { item.VehiclePic = baseUrl + @"/image/" + item.VehiclePic; } List <CarInventoryModel> carList = GetCarInventoryFilter.ListRetrieveCarInventory1(value, convertedOrderList); return(Ok(carList)); }
public IHttpActionResult Delete(int CarNumber) { string a = RentCarsInVehicleInventory.deleteFrom_db(CarNumber); return(Ok(a)); }