public IHttpActionResult DriverRatingDetails(DriverRating driverRating) { var DriverRating = new DriverBO().SaveDriverRating(driverRating); if (DriverRating) { return(Ok(new { DriverRating })); } else { return(Ok(new { Status = UTILITY.FAILURESTATUS })); } }
public IHttpActionResult TodayTripCount() { try { var DRIVERID = HttpContext.Current.Request.Headers["DRIVERID"]; int tripCount = new DriverBO().GetTripCountbyDriverID(DRIVERID); return(Ok(new { tripCount })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult DriverTodayListOfTrips() { try { var DRIVERID = HttpContext.Current.Request.Headers["DRIVERID"]; var TodayListOfTrips = new DriverBO().GetTodayListOfTrips(DRIVERID); return(Ok(TodayListOfTrips)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult GetDriverRatingDetails(string DriverID) { var driverRating = new DriverBO().GetDriverRating(new DriverRating { DriverId = DriverID }); if (driverRating != null) { return(Ok(new { driverRating })); } else { return(Ok(new { Status = UTILITY.FAILURESTATUS })); } }
public HttpResponseMessage GetDrivers() { // IEnumerable<string> dorders = doObj.GetOrders(); //List<DriverBO> dorder = routes.GetDrivers(); //return Request.CreateResponse(HttpStatusCode.OK, dorder, Configuration.Formatters.JsonFormatter); List <Data.driver> driver = repo.GetAll().ToList(); List <DriverBO> driverBOList = new List <DriverBO>(); if (driver.Count > 0) { foreach (var driv in driver) { DriverBO driverBO = new DriverBO(); driverBO.DriverKey = driv.driverkey; driverBO.FirstName = driv.firstname; driverBO.LastName = driv.lastname; driverBO.DriverId = driv.driverid; driverBO.DriversLicenseNo = driv.drivinglicenseno; driverBO.LicenseExpiryDate = driv.drivinglicenseexpirydate; driverBO.VendorKey = driv.vendkey; var address = new AddressRepository().GetbyId(driv.addrkey); driverBO.Address = new AddressBO() { AddrKey = address.addrkey, Address1 = address.address1, Address2 = address.address2, City = address.city, State = address.state, Zip = address.zipcode, Email = address.email, Phone = address.phone, Fax = address.fax }; driverBOList.Add(driverBO); } return(Request.CreateResponse(HttpStatusCode.OK, driverBOList, Configuration.Formatters.JsonFormatter)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Not found", Configuration.Formatters.JsonFormatter)); } }
public HttpResponseMessage Post([FromBody] DriverBO driverBO) { Data.driver _driver = new Data.driver(); //_driver.driverkey = driverBO.DriverKey; _driver.firstname = driverBO.FirstName; _driver.lastname = driverBO.LastName; _driver.driverid = driverBO.DriverId; _driver.drivinglicenseno = driverBO.DriversLicenseNo; _driver.drivinglicenseexpirydate = driverBO.LicenseExpiryDate; _driver.vendkey = driverBO.VendorKey; _driver.createdate = DateTime.Now; _driver.status = 1; _driver.statusdate = DateTime.Now; if (driverBO.Address != null) { var custaddress = new Data.address() { address1 = driverBO.Address.Address1, address2 = driverBO.Address.Address2, city = driverBO.Address.City, state = driverBO.Address.State, country = driverBO.Address.Country, zipcode = driverBO.Address.Zip, email = driverBO.Address.Email, fax = driverBO.Address.Fax, addrname = _driver.driverid }; var addrkey = new AddressRepository().Add(custaddress); _driver.addrkey = addrkey; } Guid custId = repo.Add(_driver); if (custId != null && custId != Guid.Empty) { return(Request.CreateResponse(HttpStatusCode.OK, custId, Configuration.Formatters.JsonFormatter)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public IHttpActionResult DriverReferral(DriverReferral driverReferral) { try { var result = new DriverBO().SaveDriverReferral(driverReferral); if (result) { SendOTP(driverReferral.Mobile,"You have been Referred for PickC Services!"); return Ok(new{ Status = UTILITY.SUCCESSMESSAGE }); } else return BadRequest(); //return Ok(result); } catch (Exception ex) { return Ok(false); } }