public ActionResult CarRequest(AracKiralama.WebUI.RentedCarWebService.RentedCar request) { RentedCarWebServiceSoapClient rentedWebService = new RentedCarWebServiceSoapClient(); RentedCarWebService.RentedCar requ = new RentedCarWebService.RentedCar(); requ.carId = request.carId; requ.CustomerName = request.CustomerName; requ.CustomerSurname = request.CustomerSurname; requ.CustomerTC = request.CustomerTC; requ.DeliveryDate = request.DeliveryDate; requ.RentDate = request.RentDate; if (rentedWebService.Insert(requ) == true) { CarWebServiceSoapClient carWebService = new CarWebServiceSoapClient(); var temp = carWebService.GetAll().Where(s => s.Id == request.carId).FirstOrDefault(); temp.IsAvailable = false; carWebService.Update(temp); return(RedirectToAction("Index")); } else { CarWebServiceSoapClient carWebService = new CarWebServiceSoapClient(); var car = carWebService.GetAll().Where(s => s.Id == request.carId).FirstOrDefault(); return(RedirectToAction("CarRequest", car)); } }
// GET: User public ActionResult Index(int?id) { CarWebServiceSoapClient carWebService = new CarWebServiceSoapClient(); IList <Car> tempList = carWebService.GetAll().Where(s => s.CompanyId == id).ToList(); return(View(tempList)); }
// GET: Home public ActionResult Index() { CarWebServiceSoapClient carWebService = new CarWebServiceSoapClient(); IList <CarWebService.Car> tempList = carWebService.GetAll().Where(s => s.IsAvailable == true).ToList(); return(View(tempList)); }
public ActionResult CarRequest(AracKiralama.WebUI.RequestWebService.Request request) { RequestWebServiceSoapClient requestWebService = new RequestWebServiceSoapClient(); RequestWebService.Request requ = new RequestWebService.Request(); requ.CarId = request.CarId; requ.CustomerName = request.CustomerName; requ.CustomerSurname = request.CustomerSurname; requ.CustomerTC = request.CustomerTC; requ.DeliveryDate = request.DeliveryDate; requ.RentDate = request.RentDate; if (requestWebService.Insert(requ) == true) { return(RedirectToAction("Index")); } else { CarWebServiceSoapClient carWebService = new CarWebServiceSoapClient(); var car = carWebService.GetAll().Where(s => s.Id == request.CarId).FirstOrDefault(); return(RedirectToAction("CarRequest", car));//car gönderilecek } }