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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:19:20+00:00 2026-06-11T07:19:20+00:00

I am fairly new to MVC 3 and I was tasked with creating a

  • 0

I am fairly new to MVC 3 and I was tasked with creating a to-do list, that has got timestamps for every independent variable, so when one variable changes, the timestamp of when it was changed would appear on the text field of that variable and not change the other timestamps of the other variables i.e each variable would have an individual timestamp. I believe I can only or most likely achieve this by creating an array. Any ideas on how I can carry this out?

I dummy code would be really appreciated

Here’s a sample of my model, I followed this tutorial http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/intro-to-aspnet-mvc-3


public class Checklist
{
public int ID { get; set; }

    public string Title { get; set; }

    public string Status { get; set; }

    [Display(Name = "Start Date")]
    public string Start_Date { get; set; }

    [Display(Name = "Complesion Date")]
    public string Complesion_Date { get; set; }

    public DateTime[] Timestamp
    {
        get { return timestamp; }
        set { timestamp = value; }

    [Display(Name = "Internal Review System Reference")]
    public string Internal_Review_System_Reference { get; set; }

    [Display(Name = "Assignment from Original Owner")]
    public bool Assignment_from_Original_Owner { get; set; }

    public class listDBContext : DbContext
{
    public DbSet<Checklist> List { get; set; }
}  

And here’s a sample of my controller code

    public class SybreController : Controller 
{
    private listDBContext db = new listDBContext();
    private Checklist check = new Checklist();
    private string oldTitle { get; set; }
    private string oldStatus { get; set; }

public ActionResult Edit(int id)// Called when edit button is clicked
{

        Checklist checklist = db.List.Find(id);
        this.oldTitle = checklist.Title;
        this.oldStatus = checklist.Status;
        //initAllArrays(checklist);//initialize our arrays with previous values
        return View(checklist);
    }
[HttpPost]
    public ActionResult Edit(Checklist checklist)
    {
        if (ModelState.IsValid)
        {              

            checklist.Timestamp = DateTime.Now;
            if (checklist.Title != this.oldTitle)
            {
                checklist.stamps[0] = DateTime.Now;
            }
            if (checklist.Status != this.oldStatus)
            {
                checklist.stamps[1] = DateTime.Now;
            }
            else
            { checklist.stamps[1] = checklist.stamps[1]; }

            db.Entry(checklist).State = EntityState.Modified;
            db.SaveChanges();

return RedirectToAction(“Index”);

Basically I need an timestamp for every individual variable in my model, so that when edited, the timestamp corresponded to when it was edited, the problem I’ve been facing is the timestamp variable changes across all the variables instead of only the one which was changed. I just need the program to print the former timestamp from when it was last edited, and if edited, display the current time along side the text field.
Hope you understand -__-

  • 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-11T07:19:22+00:00Added an answer on June 11, 2026 at 7:19 am

    You can’t solve your problem in this way. Asp.net MVC is stateless, it means that the instance of the controller is created per every request. It means that the checks that you have performed to set time stamps have always true value, as oldTitle and oldStatus are nulls.

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

Sidebar

Related Questions

I'm fairly new to ASP.NET MVC and I've got a problem with Html.TextBoxFor() -
I'm fairly new to C#, and am creating my first MVC project, and am
I am fairly new at using the ASP.NET MVC framework and was hoping that
I'm fairly new to ASP.NET MVC and jQuery. I've got a jQuery UI datepicker
I am fairly new to MVC but not sure exactly which Redirect... replaces the
I'm fairly new to ASP MVC so go easy :). I have a form
I am fairly new to ASP.NET MVC and working on a small project in
So I am fairly new to ASP.NET MVC and Windows Live Connect API. Basically
I’m fairly new at C# and MVC and have used lambdas on certain occasions,
I downloaded the fairly new Ninject 2.0 and Ninject.Web.Mvc (targeting mvc2) sources today, and

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.