I have a view on which the user can log time spent on an Activity using an HTML form. So that view loops through a list of all Activities and generates a log time form (contained in the \_LogTime partial view) for each one. The only piece of information passed to the partial view from the Index view is the ActivityId, which is placed in a hidden form. The rest of the required information is provided via the from by the user.

The problem I'm having is that once I submit one of the forms, the hidden field for all of the forms is set to the ActivityId of the form I just submitted. It's worth noting that when the page first loads (before I submit any forms), the hidden fields are correct, and when I submit a form for the first time, the correct Activity gets time logged to it (and none of the others erroneously get time logged). But any form submissions after that will only log time to the Activity I first submitted the form for.

Any idea what's going on here? Why are all of the hidden fields being set to the same ActivityId? And why only after the first POST? Let me know if you need any clarification of the problem.

Models:

```
public class Activity
{
    public int ActivityId { get; set; }
    public string Name { get; set; }
}

public class UserActivity
{
    public int UserId { get; set; }
    public int ActivityId { get; set; }
    public int Duration { get; set; }
    public DateTime Date { get; set; }
}

```

Views:

```
// Index View
@foreach (Activity activity in Model)
{
    @Html.Partial("_LogTime", new UserActivity(activity.ActivityId))
}

// _LogTime Partial View
@using (Html.BeginForm())
{
    <fieldset>
        @Html.HiddenFor(model => model.ActivityId)
        @Html.EditorFor(model => model.Duration)
        @Html.EditorFor(model => model.Date)

        <input type="submit" value="LOG TIME" />
    </fieldset>
}

```

Controller:

```
public class ActivityController : Controller
{
    private readonly DbContext _db = new DbContext();

    public ActionResult Index()
    {
        return View(_db.Activities.ToList());
    }

    [HttpPost]
    public ActionResult Index(UserActivity activity)
    {
        if (ModelState.IsValid)
        {
            _db.UserActivities.Add(activity);
            _db.SaveChanges();
        }

        return View(_db.Activities.ToList());
    }
}

```