public void Post([FromBody] driverinfo value) { Result.Run(key => { _log.Error(Newtonsoft.Json.JsonConvert.SerializeObject(value)); value.userid = HttpContext.Session.GetInt32("userid") ?? 0; if (value.userid == 0) { return; } var list = new string[] { value.idcard, value.driverlicense, value.carimage, value.drivinglicense, value.operationcertificate }; var result = downloadImage(list); value.idcard = result[0]; value.driverlicense = result[1]; value.carimage = result[2]; value.drivinglicense = result[3]; value.operationcertificate = result[4]; _log.Error(Newtonsoft.Json.JsonConvert.SerializeObject(result)); var sql = value.Insert(); _log.Error(Newtonsoft.Json.JsonConvert.SerializeObject(sql)); var n = this.db.Execute(sql); }); }
public driverinfo currentDriverInfo() { driverinfo result = null; int id = this.HttpContext.Session.GetInt32("userid") ?? 0; if (id == 0) { return(null); } try { result = this.redis.Read <driverinfo>(id.ToString()); if (result != null) { return(result); } result = db.QueryFirst <driverinfo>("select * from driverinfo where userid=" + id); this.redis.Write <driverinfo>(id.ToString(), result); return(result); } catch { return(null); } }
public driverinfo Get(int id) { driverinfo result = null; try { result = this.redis.Read <driverinfo>(id.ToString()); if (result != null) { return(result); } result = db.QueryFirst <driverinfo>("select * from driverinfo where userid=" + id); this.redis.Write <driverinfo>(id.ToString(), result); return(result); } catch { return(null); } }