public IActionResult GenerateCode([FromBody] object[] data)
        {
            List <string> spCollection = new List <string>();

            try
            {
                string webRootPath     = _hostingEnvironment.WebRootPath;     //From wwwroot
                string contentRootPath = _hostingEnvironment.ContentRootPath; //From Others

                var tblColumns = JsonConvert.DeserializeObject <List <vmColumn> >(data[0].ToString());

                string fileContentSet = string.Empty; string fileContentGet = string.Empty;
                string fileContentPut = string.Empty; string fileContentDelete = string.Empty;
                string fileContentVm = string.Empty; string fileContentView = string.Empty;
                string fileContentNg = string.Empty; string fileContentAPIGet = string.Empty;
                string fileContentAPIGetById = string.Empty;

                //SP
                fileContentSet    = SpGenerator.GenerateSetSP(tblColumns, webRootPath);
                fileContentGet    = SpGenerator.GenerateGetSP(tblColumns, webRootPath);
                fileContentPut    = SpGenerator.GeneratePutSP(tblColumns, webRootPath);
                fileContentDelete = SpGenerator.GenerateDeleteSP(tblColumns, webRootPath);
                spCollection.Add(fileContentSet);
                spCollection.Add(fileContentGet);
                spCollection.Add(fileContentPut);
                spCollection.Add(fileContentDelete);

                //VM
                fileContentVm = VmGenerator.GenerateVm(tblColumns, webRootPath);
                spCollection.Add(fileContentVm);

                //VU
                fileContentView = ViewGenerator.GenerateForm(tblColumns, webRootPath);
                spCollection.Add(fileContentView);

                //NG
                fileContentNg = NgGenerator.GenerateNgController(tblColumns, webRootPath);
                spCollection.Add(fileContentNg);

                //API
                fileContentAPIGet = APIGenerator.GenerateAPIGet(tblColumns, webRootPath);
                spCollection.Add(fileContentAPIGet);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }

            return(Json(new
            {
                spCollection
            }));
        }
        public IActionResult GenerateCode([FromBody] vmGenerator data)
        {
            var spCollection = new List <string>();

            try
            {
                var webRootPath     = _hostingEnvironment.WebRootPath;     //From wwwroot
                var contentRootPath = _hostingEnvironment.ContentRootPath; //From Others

                var tblColumns     = data.Columns;
                var fullTblColumns = GetTableColumns(data.DatabaseName, data.TableName);

                var fileContentSet            = string.Empty;
                var fileContentGet            = string.Empty;
                var fileContentGetByID        = string.Empty;
                var fileContentPut            = string.Empty;
                var fileContentDelete         = string.Empty;
                var fileContentViewSp         = string.Empty;
                var fileContentIEntity        = string.Empty;
                var fileContentModifiedEntity = string.Empty;
                var fileContentEntities       = string.Empty;
                var fileContentDtos           = string.Empty;
                var fileContentCoreRepo       = string.Empty;
                var fileContentView           = string.Empty;
                var fileContentAPIGet         = string.Empty;
                var fileContentInterface      = string.Empty;
                var fileContentService        = string.Empty;
                var fileContentDbContext      = string.Empty;
                var fileContentUnitOfWork     = string.Empty;
                var fileContentCrud           = string.Empty;
                var fileModelDapper           = string.Empty;
                var fileIUnitDapper           = string.Empty;
                var fileRepoDapper            = string.Empty;

                //SP
                fileContentSet     = SpGenerator.GenerateInsertSP(tblColumns, webRootPath);
                fileContentGet     = SpGenerator.GenerateSelectSP(tblColumns, webRootPath);
                fileContentGetByID = SpGenerator.GenerateSelectByIDSP(tblColumns, webRootPath);
                fileContentPut     = SpGenerator.GenerateUpdateSP(tblColumns, webRootPath);
                fileContentDelete  = SpGenerator.GenerateDeleteSP(tblColumns, webRootPath);
                fileContentViewSp  = SpGenerator.GenerateViewSP(tblColumns, webRootPath);
                spCollection.Add(fileContentSet);
                spCollection.Add(fileContentGet);
                spCollection.Add(fileContentGetByID);
                spCollection.Add(fileContentPut);
                spCollection.Add(fileContentDelete);
                spCollection.Add(fileContentViewSp);

                //CORE
                fileContentIEntity        = VmGenerator.GenerateIEntity(webRootPath);
                fileContentModifiedEntity = VmGenerator.GenerateModifiedEntity(webRootPath);
                fileContentEntities       = VmGenerator.GenerateEntities(fullTblColumns, webRootPath);
                fileContentDtos           = VmGenerator.GenerateDtos(tblColumns, webRootPath);
                fileContentCoreRepo       = VmGenerator.GenerateIRepository(tblColumns, webRootPath);
                spCollection.Add(fileContentIEntity);
                spCollection.Add(fileContentModifiedEntity);
                spCollection.Add(fileContentEntities);
                spCollection.Add(fileContentDtos);
                spCollection.Add(fileContentCoreRepo);

                //VU
                fileContentView = ViewGenerator.GenerateForm(tblColumns, webRootPath);
                spCollection.Add(fileContentView);

                //API
                fileContentAPIGet = APIGenerator.GenerateAPIGet(tblColumns, webRootPath);
                spCollection.Add(fileContentAPIGet);

                //API SERVICE/INTERFACE
                fileContentInterface = SIGenerator.GenerateInterfaces(tblColumns, webRootPath);
                fileContentService   = SIGenerator.GenerateService(tblColumns, webRootPath);
                spCollection.Add(fileContentInterface);
                spCollection.Add(fileContentService);

                //EF REPO
                fileContentDbContext  = RepoEFGenerator.GenerateDbContext(tblColumns, webRootPath);
                fileContentUnitOfWork = RepoEFGenerator.GenerateUnitOfWork(webRootPath);
                fileContentCrud       = RepoEFGenerator.GenerateCrud(tblColumns, webRootPath);
                spCollection.Add(fileContentDbContext);
                spCollection.Add(fileContentUnitOfWork);
                spCollection.Add(fileContentCrud);

                //DAPPER REPO
                fileModelDapper = DapperGenerator.GenerateModel(tblColumns, webRootPath);
                fileIUnitDapper = DapperGenerator.GenerateUnitOfWork(tblColumns, webRootPath);
                fileRepoDapper  = DapperGenerator.GenerateRepository(tblColumns, webRootPath);
                spCollection.Add(fileModelDapper);
                spCollection.Add(fileIUnitDapper);
                spCollection.Add(fileRepoDapper);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }

            return(Json(new
            {
                spCollection
            }));
        }