// GET: Personal_agregarVM/Create public IActionResult Create() { Personal_agregarVM pc = new Personal_agregarVM(); pc.Dia_1 = true; pc.Dia_2 = true; pc.Dia_3 = true; pc.Dia_4 = true; pc.Dia_5 = true; string dateInput = "Jan 1, 9999"; DateTime parsedDate = DateTime.Parse(dateInput); pc.EndDa = parsedDate; pc.BegDa = DateTime.Now; // pc.Bukrs = "0"; dateInput = "Mar 1,1975"; parsedDate = DateTime.Parse(dateInput); pc.GbDat = parsedDate; ViewBag.GpoCiaG = HttpContext.Session.GetString(SessionGpoCia); pc.Gbukrs = ViewBag.GpoCiaG; List <Divis> divislist = new List <Divis>(); divislist = (from divis2 in _context.Divis select divis2).ToList(); //agregando los items a la lista divislist.Insert(0, new Divis { Id = 0, Descrip = "Select" }); //asignar category list to viewbag ViewBag.ListofCategory = divislist; ViewBag.ListofTitles = _bukrs.GetTitle(); ViewBag.ListofClasedeContrato = _bukrs.GetClasedeContrato(); ViewBag.ListofClavedeSexo = _bukrs.GetClavedeSexo(); ViewBag.ListofRegion1 = _bukrs.GetRegion1(); ViewBag.ListofEstado = _bukrs.GetRegion1(); ViewBag.ListofTipoPago = _bukrs.GetTipoPago(); ViewBag.ListofPerPru = _bukrs.GetPeriodoPrueba(); if (ViewBag.GpoCiaG == null) { HttpContext.Session.SetString(SessionRegresa, "Create:Personal_agregarVM"); return(RedirectToAction("Index", "GpoCiaGlobal")); //return Redirect("GpoCiaGlobal/Index"); } else { HttpContext.Session.SetString(SessionRegresa, ""); } var items = new List <SelectListItem>(); items = _bukrs.DaBukrs2(ViewBag.GpoCiaG); //items = DaBukrs(ViewBag.GpoCiaG); ViewBag.DaBukrs = items.ToList(); return(View(pc)); }