Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6544949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:31:37+00:00 2026-05-25T11:31:37+00:00

I have a controller with an action Review like so: [HttpPost, HttpGet] [RoleRequired(Payroll Tech)]

  • 0

I have a controller with an action Review like so:

    [HttpPost, HttpGet]
    [RoleRequired("Payroll Tech")]
    public ActionResult Review(ReviewModel model)
    {
        PayrollManagement.Importer importer = new PayrollManagement.Importer(
            ConfigurationManager.ConnectionStrings["ImportDatabase"].ConnectionString,
            model);

        model.Discrepancies = importer.GetDiscrepancyReport();
        return View(model);
    }

    [RoleRequired("Payroll Tech")]
    public ActionResult Review()
    {
        ReviewModel model = new ReviewModel();
        model.Initialize();  //initializes the dropdown collections
        model.Discrepancies = new List<DiscrepancyReportItem>();
        return View(model);
    }

I am trying to invoke this method on a RedirectToAction call from my Upload method:

    [HttpPost]
    [RoleRequired("Payroll Tech")]
    public ActionResult Upload(UploadModel model)
    {
        string tmpFile = Path.GetTempFileName();
        model.File.SaveAs(tmpFile);
        PayrollManagement.Importer importer = new PayrollManagement.Importer(
            ConfigurationManager.ConnectionStrings["ImportDatabase"].ConnectionString,
            model);

        importer.UploadExcelDocument(tmpFile);
        return RedirectToAction("Review", (IImporterFileInfo)model);
    }

This seems to work appropriately, in that when the Upload event is called, the redirect adds the model elements to the URL, which I would expect to be mapped to the ReviewModel object.

Instead, the generic Review (not HttpPost or HttpGet) is invoked, which is not what I would expect. Why is it not mapping to the model and persisting the data? What can I do to make the core data in the IImporterFileInfo interface carry on to the next screen, wizard-like?

I will include the model structure as well, so ppl can see what I’m trying to do.

public class BaseModel : IImporterFileInfo
{

    [Display(Name = "Financial System:")]
    public string FinancialSystem { get; set; }

    [Display(Name = "Fiscal Year:")]
    public int FiscalYear { get; set; }

    [Display(Name = "Fiscal Week:")]
    public int FiscalWeek { get; set; }

    [Display(Name = "Accrual File?")]
    public bool IsAccrual { get; set; }

    [Display(Name="Accrual Month:")]
    public int AccrualMonth { get; set; }

    public void Initialize()
    {
        this.FinancialSystem = "Legacy";
        this.FiscalWeek = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
        this.FiscalYear = DateTime.Now.Year;
        this.AccrualMonth = DateTime.Now.Month;
    }

    //the readonly lists
    private IList<string> _FinancialSystems;
    public IList<string> FinancialSystems
    {
        get
        {
            if (_FinancialSystems == null)
            {
                IList<string> choices = new List<string>();
                choices.Add("Legacy");
                choices.Add("Morris");
                _FinancialSystems = choices;
                //_FinancialSystems = new SelectList(choices, this.FinancialSystem ?? "Legacy");
            }
            return _FinancialSystems;
        }
    }

    private IList<int> _FiscalWeeks;
    public IList<int> FiscalWeeks
    {
        get
        {
            if (_FiscalWeeks == null)
            {
                IList<int> choices = new List<int>();
                for (int i = 1; i <= 53; i++)
                {
                    choices.Add(i);
                }
                _FiscalWeeks = choices;
            }
            return _FiscalWeeks;
        }
    }

    private IList<int> _FiscalYears;
    public IList<int> FiscalYears
    {
        get
        {
            if (_FiscalYears == null)
            {
                IList<int> choices = new List<int>();
                for (int i = DateTime.Now.Year - 7; i <= DateTime.Now.Year + 1; i++)
                {
                    choices.Add(i);
                }
                _FiscalYears = choices;
            }
            return _FiscalYears;
        }
    }

    private IList<int> _AccrualMonths;
    public IList<int> AccrualMonths
    {
        get
        {
            if (_AccrualMonths == null)
            {
                IList<int> choices = new List<int>();
                for (int i = 1; i <= 12; i++)
                {
                    choices.Add(i);
                }
                _AccrualMonths = choices;
            }
            return _AccrualMonths;
        }
    }

}

public class UploadModel : BaseModel
{
    [Display(Name = "File Name:")]
    public HttpPostedFileBase File { get; set; }
}

public class ReviewModel : BaseModel
{
    public IList<DiscrepancyReportItem> Discrepancies { get; set; }
}

I think this should work pretty well. Dunno why it doesn’t. The query string looks like:

https://localhost:44301/Import/Review?File=System.Web.HttpPostedFileWrapper&FinancialSystem=Legacy&FiscalYear=2011&FiscalWeek=33&IsAccrual=True&AccrualMonth=8&FinancialSystems=System.Collections.Generic.List`1%5BSystem.String%5D&FiscalWeeks=System.Collections.Generic.List`1%5BSystem.Int32%5D&FiscalYears=System.Collections.Generic.List`1%5BSystem.Int32%5D&AccrualMonths=System.Collections.Generic.List`1%5BSystem.Int32%5D
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:31:38+00:00Added an answer on May 25, 2026 at 11:31 am

    take a look at this question, one option you could do is use TempData, hold the model or whatever you will need in the next call

    MVC – Passing Data with RedirectToAction()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a controller action defined as: public ActionResult(MyModel model, string someParameter)
I have a controller action which renders a partial view: public ActionResult Details(int id)
I have a controller action which I would like to call another controller action.
I have a POST controller action like: if (ModelState.IsValid) { try { //.. save
I would like to have controller GET action that returns a JSON-serialized dictionary. The
This question pertains primarily to good design. Suppose I have a controller action like
I have a controller action that effectively simply returns a JsonResult of my model.
I have controller with action new , and I want it to create ActiveRecord::Base
I have a controller action that is being executed by a link that was
I have a controller action that checks this.User.Identity.IsAuthenticated What do you suggest how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.