public ActionResult Generate() { try { var monthYear = DateTime.Now.Month.ToString("D2") + Convert.ToInt32(DateTime.Now.Year.ToString().Substring(2, 2)).ToString("D2"); var productionDateCodes = _iCommonManager.GetAllProductionDateCode().ToList(); var productionLines = _iCommonManager.GetAllProductionLines().ToList(); var courrentCode = _iCommonManager.GetProductionDateCodeByMonthYear(monthYear).ToList().First(); var list = new SelectList(productionDateCodes, "ProductionDateCodeId", "Code", courrentCode.ProductionDateCodeId); ViewBag.ProductionDateCodeId = list; ViewBag.ProductionLineId = new SelectList(productionLines, "ProductionLineId", "LineNumber"); return(View()); } catch (Exception exception) { Log.WriteErrorLog(exception); return(PartialView("_ErrorPartial", exception)); } }