public SanPhamModel CreateSP([FromBody] SanPhamModel model) { if (model.image != null) { var arrData = model.image.Split(';'); if (arrData.Length == 3) { var savePath = $@"assets/Upload/SanPham/{arrData[0]}"; var savePathh = $@"assets/Upload/SanPham/{arrData[0]}"; model.image = $"{savePath}"; SaveFileFromBase64String(savePath, arrData[2]); SaveFileFromBase64(savePathh, arrData[2]); } } model.id = Guid.NewGuid().ToString(); sanpham.CreateSP(model); return(model); }