Exemplo n.º 1
0
        protected override Task Handle(CancellationToken cancellationToken)
        {
            var mfuFile = new Mfufile()
            {
                EnterDate = DateTime.Now,
                FileName  = configuration.GetValue <string>("FileName:RP147")
            };

            var mfuFileResult = dbContext.Add(mfuFile);

            MemoryStream fileStream = new MemoryStream(Request.ImportedFile.File);

            var mfumodelList = GetMfuModelList(FileHelper.ExcelExportDataTable(fileStream));

            foreach (var mfumodel in mfumodelList)
            {
                mfumodel.FileId = mfuFileResult.Entity.FileId;
                dbContext.Mfumodel.Add(mfumodel);
            }

            dbContext.SaveChanges();

            Response.AddMessage("File Imported Successfully.", "", MessageTypes.Success, isEndUserMessage: true);

            return(Response.SetSuccess().AsTask());
        }
Exemplo n.º 2
0
        private int InsertExcelFile(ExcelFile excelFile)
        {
            var result = dbContext.Add(excelFile);

            dbContext.SaveChanges();
            mFUOperationsHelper.InsertExcelFileHistory(result.Entity, dbContext);
            return(result.Entity.ExcelFileId);
        }