public HttpResponseMessage AddUser2() { //[FromBody]User user User user = new User(); //user.OpenId = "033E1cZ82rNiJQ0SS9292qejZ82E1cZk";//唯一主键 //user.UserId = "lzc123";//UserId //user.UserPwd = "lzc123";//密码 //user.UserName = "******";//姓名 //user.UserPhone = "18827507367";//手机号 //user.Photo = "lzclogo.jpg";//头像 //user.Sex = "1";//性别sex //user.Birth = "1997-10-14";//生日 //user.IsOut = "0";//是否离职(0不离职;1离职;2注销系统;3已注册未通过) //user.CompanyId = "10101010101";//公司Id (guid) user.OpenId = HttpContext.Current.Request["OpenId"]; user.UserId = HttpContext.Current.Request["UserId"]; user.UserPwd = HttpContext.Current.Request["UserPwd"]; user.UserName = HttpContext.Current.Request["UserName"]; user.Sex = HttpContext.Current.Request["Sex"]; //user.CompanyId = HttpContext.Current.Request["CompanyId"]; user.Birth = HttpContext.Current.Request["Birth"]; user.UserPhone = HttpContext.Current.Request["UserPhone"]; user.IsOut = HttpContext.Current.Request["IsOut"]; //WriteLog("user.OpenId:" + user.OpenId); //WriteLog("user.UserId:" + user.UserId); //WriteLog("user.UserName:"******"image"]; if (file != null) { //WriteLog("file:" + file); //图片的名字 string strFileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".jpg"; //WriteLog("filename:" + strFileName); //路径 string strFilePath = HttpContext.Current.Server.MapPath("~/Images/UserPhoto/") + strFileName; //图片路径 user.Photo = "/Images/UserPhoto/" + strFileName; //WriteLog("photo:" + user.Photo); file.SaveAs(strFilePath); } else { user.Photo = null; } //多图上传 //HttpContext context = HttpContext.Current; //HttpFileCollection files = context.Request.Files; //string path = context.Request.MapPath("~/"); //string strPath = path + "App_Data/"; //for (int i = 0; i < files.Count; i++) //{ // strPath += files[i].FileName; // files[i].SaveAs(strPath); //} //context.Response.Clear(); //context.Response.Write(strPath); //context.Response.End(); return(new HttpResponseMessage { Content = new StringContent(userBLL.AddUser2(user), Encoding.GetEncoding("UTF-8"), "text/json") }); }