public ActionResult ProductionEntry(int?id, int?foodMenuType, int?productionFormulaId, string type) { if (UserRolePermissionForPage.Add == true || UserRolePermissionForPage.Edit == true || UserRolePermissionForPage.View == true) { ProductionEntryModel productionEntryModel = new ProductionEntryModel(); TempData["foodMenuType"] = foodMenuType; if (id > 0) { ViewBag.ActionType = type; productionEntryModel = _iProductionEntryService.GetProductionEntryById(Convert.ToInt32(id)); } else { if (Convert.ToInt32(productionFormulaId) > 0) { productionEntryModel = _iProductionEntryService.GetProductionFormulaById(Convert.ToInt32(productionFormulaId)); } productionEntryModel.ProductionDate = DateTime.UtcNow.AddMinutes(LoginInfo.Timeoffset); productionEntryModel.FoodmenuType = Convert.ToInt32(foodMenuType); } productionEntryModel.ProductionFormulaList = _iDropDownService.GetProductionFormulaList(Convert.ToInt32(foodMenuType)); productionEntryModel.FoodMenuList = _iDropDownService.GetFoodMenuListByFoodmenuType(3); productionEntryModel.IngredientList = _iDropDownService.GetIngredientList(); productionEntryModel.StoreList = _iDropDownService.GetStoreList(); ViewBag.SelectedStore = productionEntryModel.StoreList.Where(x => x.Selected == true).Select(x => x.Value).SingleOrDefault(); return(View(productionEntryModel)); } else { return(RedirectToAction("NotFound", "Error")); } }