public string ProcessTemplate(CommonModelHelper model, Company comapny, Estimation estimation) { var html = System.IO.File.ReadAllText(HostingEnvironment.MapPath($"~/EmailTemplate/EstimationRequest_{model.Culture}.html")); var match = Regex.Matches(html, @"\[([A-Za-z0-9\-._]+)]", RegexOptions.IgnoreCase); foreach (var v in match) { var result = string.Empty; var originalString = v.ToString(); var x = v.ToString(); x = x.Replace("[", ""); x = x.Replace("]", ""); if (x.Contains("Company")) { var prop = x.Split('.')[1]; result = comapny.GetType().GetProperty(prop).GetValue(comapny, null)?.ToString(); } else { x = x.Contains("_") ? x + model.Culture : x; result = estimation.GetType().GetProperty(x).GetValue(estimation, null)?.ToString() ?? ""; } html = html.Replace(originalString, result.ToString()); } return(html); }