public IActionResult Index(int Id = 0) { ViewBag.StoresList = new SelectList(_storesRespository.GetStoresByUserId(this.loginUserId), "Id", "StoreName"); ViewBag.SurveyList = new List <SurveyForm_VM>(); ViewBag.MenuItemList = new List <MenuItem_VM>(); var voucherSetup = new VoucherSetup_VM(); if (Id > 0) { voucherSetup = _voucherSetupRepository.Get(Id, this.loginUserId, isAdmin); if (voucherSetup == null) { return(RedirectToAction("List", "VoucherSetup")); } else { ViewBag.MenuItemList = new SelectList(_menuItemRepository.GetMenuItemForVoucherSetUp(this.loginUserId, clientId).Where(c => voucherSetup.StoreIds.Contains(c.StoreId)).ToList(), "Id", "Name"); ViewData["Title"] = "Edit"; return(View(voucherSetup)); } } else { ViewData["Title"] = "Add"; return(View(voucherSetup)); } }