I'm unsure if this has been asked before but here goes.
I have an MVC application with the HTML looking like this;
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<EnvironmentalVandals.Controllers.MonthlyItemsFormViewModel>" %>
I have in the controller the following;
    [Authorize]
    public ActionResult Edit(int? id)
    { snip }
Then on a submit button event;
    [AcceptVerbs(HttpVerbs.Post)]
    [Authorize]
    public ActionResult Edit(FormCollection collection)
    {
        CalendarItem fvm = new CalendarItem();
        UpdateModel(fvm);
    }
If I am updating an existing event I have no problems. If I am adding a new event I get an error that UpdateModel failed to update the model.
If I remove the "int? id" parameter from the first ActionResult the model is updated on both new and existing events.
When I am editing an event I use the following HTML; <%=Html.ActionLink("Edit", "Edit", new {id=Model.Event.id}) %> and when I am creating a new event I use <%=Html.ActionLink("Add event","Edit", "Calendar") %>.
Now admitably I probably shouldn't be using the same View for both update and create and should perhaps refactor into two views and a PartialView.
So, is that the solution or is there something else I am doing wrong?
Thanks in advance.
</griegs>