public HotpResponse View(string method, string controller, object model = null) { StackTrace stackTrace = new StackTrace(); StackFrame stackFrame = stackTrace.GetFrame(1); string fileContent = File.ReadAllText(@"../../View/" + controller + "/" + method + ".homl"); HotpResponse response = new HotpResponse(HotpStatus.OK, HotpMimeType.HOML, fileContent); return(response); }
public HotpResponse View(object model = null) { StackTrace stackTrace = new StackTrace(); StackFrame stackFrame = stackTrace.GetFrame(1); string fileContent = File.ReadAllText(@"../../View/" + stackFrame.GetMethod().ReflectedType.Name + "/" + stackFrame.GetMethod().Name + ".homl"); HotpResponse response = new HotpResponse(HotpStatus.OK, HotpMimeType.HOML, fileContent); return(response); }
public HotpResponse RedirectToAction(string method, string controller, object[] parameters = null) { Assembly asm = Assembly.GetEntryAssembly(); string fullName = String.Format("{0}.Controller.{1}", asm.FullName.Split(',')[0], controller).ToLower(); Type type = asm.GetType(fullName, true, true); object instance = Activator.CreateInstance(type); MethodInfo methodInfo = type.GetMethod(method, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); HotpResponse response = (HotpResponse)methodInfo.Invoke(instance, parameters); return(response); }