public IActionResult FiltersItems([FromBody] FiltersModel model) { string path = ""; string data = ""; IARresponse = BadRequest(); try { ds = db.GetItemsByFilters(model); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { path = _hostingEnvironment.WebRootPath + "/images/Products/ProductsCategory/ProductsSubCategory/itemimg/" + row["cat_img"].ToString(); byte[] b = System.IO.File.ReadAllBytes(path); data = "data:image/png;base64," + Convert.ToBase64String(b); row["cat_img"] = data; } } } IARresponse = Ok(new { res = ds }); } catch (Exception ex) { IARresponse = BadRequest(new { error = ex.Message }); } return(IARresponse); }