public ActionResult Contact() { ViewBag.Title = "Contact"; Contact _contact = new Contact() { Address = "Hyderabad", Email = "*****@*****.**", Website = "www.test.com", Title = "Contact", Message = "MVC Common Helper class for generating html from razor view" }; return View(_contact); }
public string GeContactView() { Contact _contact = new Contact() { Address = "Hyderabad", Email = "*****@*****.**", Website = "www.test.com", Title = "Contact", Message = "MVC Common Helper class for generating html from razor view" }; CommonHelper commonHelper = new CommonHelper(); string _path = "~/Views/Home/Contact.cshtml"; string _controllerName = "Home"; string _viewName = "Contact"; string result = commonHelper.GenerateViewToString<Contact>(new HomeController(), _path, _controllerName, _viewName, _contact); return result; }