samedi 2 janvier 2016

Redirect to Action

Redirect to action

public ActionResult CreateDetailDisbursment(int EmpPayrollID,int  DisbursementDetailID, int PeriodWisePRID)
    {
        PayrollRepository _PRRepository = new PayrollRepository();
        VMDisbursementDetail _viewModel = new VMDisbursementDetail();  
        var temp = _PRRepository.GetAllDisbursmentsGroupsbyPeriodWiseID(PeriodWisePRID).Distinct().ToList();
        ViewData["Disbursment"] = new SelectList(temp, "DisburstmentID", "DisburstmentCode", 1);
        ViewBag.Bank = _PRRepository.GetBankAcc().Select(x => new KeyValuePair<int, string>(x.EmpBnkAccID, x.Branch)).ToList();

        DisbursementDetail DetailDisb = _PRRepository.GetDisbursementByDisbursementDetID(DisbursementDetailID);
        if (DetailDisb == null)
        {
            return View(_viewModel);
        }
        else
        {
            int id = EmpPayrollID;
            return RedirectToAction("UndisburseSalary", "Payroll", id); 
        }


    }


 public ActionResult UndisburseSalary(int id) 
    {
        PayrollRepository _PRRepository = new PayrollRepository();
        var det = _PRRepository.GetEmpPayrollDetailByEmpPayroll(id);
        return View();
    }

i am getting id in undisbursesalary but it give error

The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult UndisburseSalary(Int32)' in 'Evolet.Web.Controllers.PayrollController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters

Aucun commentaire:

Enregistrer un commentaire