public async Task <IActionResult> Create([Bind("Excel,Reportes")] ProdEntry entry) { if (ModelState.IsValid) { if (entry?.Excel == null) { return(View(nameof(Create))); } entry.AppUserId = _userManager.GetUserId(User); entry.IP = Request.HttpContext.Connection.RemoteIpAddress.ToString(); entry.FileName = entry.Excel.FileName; entry.Date = DateTime.Now; entry.Success = false; _context.Add(entry); await _context.SaveChangesAsync() .ConfigureAwait(false); var result = string.Empty; //var debug = false; var toskip = new List <string> { "Row", "Sheet", "Centre", "Rows", "Id", "Origin" }; if (entry.Reportes != Tipo.Producción) { toskip.Add("TipoProduccion"); toskip.Add("Dato"); toskip.Add("TipoItemProduccion"); } if (entry.Reportes != Tipo.Semilla) { toskip.Add("OrigenId"); toskip.Add("Origen"); } Stream stream = entry.Excel.OpenReadStream(); ExcelPackage package = new ExcelPackage(stream); await _import.Read <Planilla>(package, entry, toskip).ConfigureAwait(false); return(RedirectToAction(nameof(Index), new { id = entry.Id })); } var Filters = new Dictionary <string, List <string> > { ["Tipo"] = new List <string> { "Semilla", "Cosecha", "Abastecimiento", "Producción" } }; ViewData[nameof(Tipo)] = EViewData.Enum2Select <Tipo>(Filters, "Name"); return(View(entry)); }