public string ControllerClassGen(ControllerOutputViewModel controllerOutputVM) { string controllerName = controllerOutputVM.ControllerName; string entityName = controllerOutputVM.EntityName; string dbContextName = controllerOutputVM.DbContextName; string appNameSpace = controllerOutputVM.AppNameSpace; string appUsingPrefix = controllerOutputVM.AppUsingPrefix; string moduleName = controllerOutputVM.ModuleName; string controllerClassCode = null; controllerClassCode += ControllerUsingCode(appUsingPrefix, moduleName); controllerClassCode += ControllerNamespaceCode(appNameSpace); controllerClassCode += "{" + lb; controllerClassCode += tab + "public class " + controllerName + "Controller : Controller" + lb; controllerClassCode += tab + "{" + lb; controllerClassCode += ControllerClassVarsCode(dbContextName); controllerClassCode += ControllerConstructorCode(controllerName, dbContextName); controllerClassCode += ControllerIndexCode(entityName); controllerClassCode += ControllerDetailsCode(entityName); controllerClassCode += ControllerCreateCode(entityName); controllerClassCode += ControllerEditCode(entityName); controllerClassCode += ControllerDeleteCode(entityName); controllerClassCode += tab + "}" + lb; controllerClassCode += "}" + lb; return(controllerClassCode); }
public IActionResult ControllerCreateResults(ControllerOutputViewModel controllerOutputViewModel) { if (ModelState.IsValid) { var controllerGenBusinessLogic = new ControllerGenBusinessLogic(); controllerOutputViewModel.ControllerCode = controllerGenBusinessLogic.ControllerClassGen(controllerOutputViewModel); return(View(controllerOutputViewModel)); } return(View("ControllerCreate", controllerOutputViewModel)); }