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

  • Home
  • SEARCH
  • 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 8565901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:32:06+00:00 2026-06-11T17:32:06+00:00

I am running into a problem where a list object is selected, edited, and

  • 0

I am running into a problem where a list object is selected, edited, and then redirected back to the list, but the object is not showing that it has been updated on the list. If the edited object’s details view is selected, the editing to the object has been saved. I need the list to update the changes that have been made.

This is the method that the generates the list for the “Index” view:

public static List<MortgageCancellation> DealerSorting(string id,string dealerId)
    {
        var d = from u in db.MortgageCancellations
                where u.DealerID == dealerId
                select u;
        switch (id)
        {
            case "DealID":
                return d.OrderBy(u => u.DealID).ToList();
            case "PrimaryFirstName":
                return d.OrderBy(u => u.PrimaryFirstName).ToList();
            case "PrimaryLastName":
                return d.OrderBy(u => u.PrimaryLastName).ToList();
            case "DateOfApplication":
                return d.OrderBy(u => u.DateOfApplication).ToList();
            case "ProfileStatus":
                return d.OrderBy(u => u.ProfileStatus).ToList();
            case "CurrentStep":
                return d.OrderByDescending(u => u.CurrentStep).ToList();
            case "LastUpdated":
                return d.OrderByDescending(u => u.LastUpdated).ToList();
            default:
                return d.ToList();
        }
    }

This is where the editing takes place, which you can see saves the changes:

public ActionResult Edit(MortgageCancellation mortgagecancellation)
    {
        try
        {
            if (ModelState.IsValid)
            {
                mortgagecancellation.DateOfApplication = (DateTime?)Session["appDate"];
                Session.Remove("appDate");
                mortgagecancellation.LastUpdated = DateTime.Now;
                db.Entry(mortgagecancellation).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(mortgagecancellation);
        }
        catch (Exception ex)
        {
            SupportEmail se = new SupportEmail(error, ex);
            SupportEmail.SendSupportEmail(se);
            return View("Error");
        }
    }

I’m not sure why the “Index” view isn’t showing the changes that have been made as this is the only method called from the “Index” view:

return View(MortgageCancellation.OfficeSorting(id));

One more thing, the list eventually shows the changes, but I need the list show the changes immediately.

This is where the db is initialized:

private static MyDBContext db = new MyDBContext();
  • 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-06-11T17:32:07+00:00Added an answer on June 11, 2026 at 5:32 pm

    try to replace

    private static MyDBContext db = new MyDBContext();
    

    with a

    using(var db = new MyDBContext())
    {
        ...code..
    }
    

    for each action.

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

Sidebar

Related Questions

I'm running into a problem when trying to create an ArrayList in Java, but
I am running into a problem that just doesn't seem right. I've got a
My company is running into a problem with a web service that is written
i'm running into a problem in my maven build recently, that it downloads a
I'm running into this problem often: I'm creating a function that needs to perform
I'm trying to create an object in a function, but I am running into
Running into a problem. I have a table defined to hold the values of
I'm running into a problem inserting rows from a file with 13,000 rows into
I'm running into a problem when trying to select records from my 2005 MS-SQL
I'm running into the problem of users being able to submit data with '

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.