public IHttpActionResult UpdateDriver(Driver driver) { try { var DRIVERID = HttpContext.Current.Request.Headers["DRIVERID"]; var driverBO = new DriverBO(); var driverObj = driverBO.GetDriver(new Driver { DriverID = DRIVERID }); if (driverObj != null) { driverObj.DriverName = driver.DriverName; driverObj.Password = driver.Password; driverObj.ModifiedBy = "ADMIN"; var result = driverBO.SaveDriver(driverObj); if (result) { return(Ok(UTILITY.SUCCESSMSG)); } else { return(BadRequest()); } } else { return(NotFound()); } } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult GetDriver() { try { var driverBO = new DriverBO(); var DRIVERID = HttpContext.Current.Request.Headers["DRIVERID"]; var driverObj = driverBO.GetDriver(new Driver { DriverId = DRIVERID }); if (driverObj != null) { return Ok(driverObj); } else return NotFound(); } catch (Exception ex) { return InternalServerError(ex); } }