// POST api/basicinformation public int Post([FromBody] BasicInformaionEntities item) { var root = System.Web.Hosting.HostingEnvironment.MapPath("~/images/"); DirectoryInfo di = new DirectoryInfo(root); FileInfo[] images = di.GetFiles(); foreach (FileInfo image in images) { var name = image.Name; if (name.Contains("user.png")) { long imageFileLength = image.Length; FileStream fs = new FileStream(root + name, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); var imageData = br.ReadBytes((int)imageFileLength); item.EMPIMG = imageData; } } //string[] files = Directory.GetFiles(root, "*.png"); //foreach (string file in Directory.GetFiles(root)) //{ // var name = file.fo; // if (name.Contains(keyword)) // { // imgname = name; // } //} return(_Basicinfo.CreateEmployeebasicinfo(item)); }
public int Post([FromBody] BasicInformaionEntities item) { return(_Basicinfo.CreateEmployeebasicinfo(item)); }