public string AddBigHouse(int id, string filePath) { string reslut = null; try { filePath = "C:\\Users\\admin\\Desktop\\测试文件\\" + filePath; List <byte> fileData = File.ReadAllBytes(filePath).ToList(); bighouseinfo house = new bighouseinfo { _id = id, remark = fileData }; int res = mongoDBHelper.Insert(house); if (res == 1) { //mongoDBHelper.Delete<bighouseinfo>(o => o._id == 1); reslut = "成功"; } else { reslut = "失败:" + filePath; } } catch (Exception e) { reslut = e.Message; } return(reslut); }
public string AddBigHouse(int size) { string reslut = null; try { byte[] ss = new byte[size]; bighouseinfo house = new bighouseinfo { _id = 1, remark = ss.ToList() }; int res = mongoDBHelper.Insert(house); if (res == 1) { mongoDBHelper.Delete <bighouseinfo>(o => o._id == 1); reslut = "成功"; } else { reslut = "失败:" + size; } } catch (Exception e) { reslut = e.Message; } return(reslut); }