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 9205463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:57:21+00:00 2026-06-17T23:57:21+00:00

I have an EDM. I pass a model to a view when it is

  • 0

I have an EDM. I pass a model to a view when it is displayed based on the boolean value of the Current field (Only one record will ever be current):

public ActionResult Index()
{
    myEDM db = new MyEDM();
    MyEDMModel model = db.MyEDMTable.Where(g => g.Current == 1).First();
    return View(model);
}

The table has 10 columns

fld1 fld2 fld3 ......

Each of the fields is created with a default value of emptystring ” for comparison reasons (I cannot compare to Null).

In the view I display a background image and a HTML.Actionlink based on the content of each field:

@if (Model.fldNo1 == "")
{
    <td class="number">
        @Html.ActionLink("1", "TakeNumber", "Numbers", new { Model, number = 1 })
    </td>
}
else
{
    <td class="numberTaken">
        @Html.ActionLink("1", "NumberTaken", "Home", new { Model, number = 1 })
    </td>
}

Each field can be taken and reserved by the user. Only one user per field (obviously) and if the field != ” then I must do nothing. The field is reserved by someone else. The field is populated with the userID if available.

This is where my question comes in. I have passed the model from the load of the page from the EDM. If the user then browses the view for say 5 minutes and then selects to reserve a specific number. In order to check if another user has reserved this field in the 5 minutes of browsing time do I need to refresh the model from the EDM or is the passed model updated dynamically? i.e.

Do I do this:

myEDM db = new MyEDM();
Int32 muser = (Int32)Membership.GetUser().ProviderUserKey;
String user = muser.ToString();

if (number == 1 && model.fldNo1 == "")
{
    model.fldNo1 = user;
    UpdateModel(model);
    db.SaveChanges();
}
elseif ...........

Or must I first recall or refresh the model to ensure an entry in particular field has not been entered in the duration of the users browsing (5minutes for example):

myEDM db = new MyEDM();
myEDMModel updateEDMModel = db.MyEDMTable.Where(g => g.id == model.id).First 
Int32 muser = (Int32)Membership.GetUser().ProviderUserKey;
String user = muser.ToString();

if (number == 1 && updateEDMModel.fldNo1 == "")
{
    updateEDMModel.fldNo1 = user;
    UpdateModel(updateEDMModel);
    db.SaveChanges();
}
elseif ...........

Unfortunately I am a one man band and I am having great difficulty testing this.

  • 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-17T23:57:22+00:00Added an answer on June 17, 2026 at 11:57 pm

    A model populated from Entity Framework and passed to your View is no longer attached. Even if you made your EF call from your View (bad practice, dont), the rendered values would not be attached.

    So, NO, your displayed values would NOT change as the database values changed

    In order to create the behavior you want, you would need to use an Ajax method.

    One I like a lot is to use an @Html.Action() partial. Call if in a

    <script type="text/javascript">
                window.setInterval(
                    $.get('@Url.Action("StillOnline", "Account")'), 10000);
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an EntityFramework model which has a boolean field. To make the mapping
Have deployed numerous report parts which reference the same view however one of them
Let's say I have an web CMS type application, and an EDM model with
I have 2 projects - a class library containing an EDM Entity Framework model
Hey, I have service and EDM model - Model1Container : public class Service1 :
I have a problem with EDM model Union select. I have the records in
I have a WPF combobox control bound to a edm field in a database
I have an error: One or more validation errors were detected during model generation:
I have a code-first EF model based on 4.3.1. In this model there is
I am using EF4 with the EDM designer. I have two tables : Users

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.