0

C# と SQL Server 2005 を使用して ASP .Net MVC 3 アプリケーションを開発しています。

Entity Framework と Code First Method も使用しています。

ビュー「Gestion.ascx」から値を取得し、ボタンを使用してリストに保存したいと考えています。

これは私が試したものですが、結果はありません:

The View Gestion :
<% using (Html.BeginForm("Save", "Anouar")) { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset class="parametrage">
        <legend>Gestion de Gamme</legend>

        <div><%:Html.Label("Poste :")%><%: Html.DropDownList("SelectedPoste", Model.PostesItems)%><input type="checkbox" name="option1" value="Poste Initial" id= "chkMain" onclick="test();"/>Poste Initial<input type="checkbox" name="option2" value="Poste Final" id= "chkFirst" onclick="test2();"/>Poste Final</div>


         <div><%:Html.Label("Nombre de Passage :")%><%: Html.EditorFor(x=>x.YourGammeModel.Nbr_Passage)%></div>
        <div><%:Html.Label("Position :")%><%: Html.EditorFor(x=>x.YourGammeModel.Position)%></div>
        <div><%:Html.Label("Poste Précédent :")%><%: Html.DropDownList("PostePrecedentSelected", Model.PostesItems)%></div>
        <div><%:Html.Label("Poste Suivant :")%><%: Html.DropDownList("PosteSuivantSelected", Model.PostesItems)%></div>


        <div><input type="submit" value="Enregistrer" id="btnSave"  /></div>

        </fieldset>

コントローラー「AnouarController」は、ビュー「Gestion」に入力するコントローラーです。

public class AnouarController : Controller
    {

         private GammeContext db = new GammeContext();


        //
        // GET: /Anouar/

         public ActionResult Gestion(FlowViewModel model)
         {

             model.YourGammeModel = new Gamme();
             return PartialView(model);

         }




         public ActionResult Save(Gamme gamme)
         {
             UserGammes.Add("currentUserID", gamme);

         }

    }

最後にモデル FlowViewModel :

public class FlowViewModel 
{ 

[Key] 
public string IDv { get; set; } 
[NotMapped] 
public SelectList PostesItems { get; set; } 

public List<Profile_Ga> Profile_GaItems { get; set; } 
public List<Gamme> GaItems { get; set; } 

public Gamme YourGammeModel { get; set; } 

public int SelectedProfile_Ga { get; set; } 

public int SelectedGamme{ get; set; } 

public int SelectedPoste { get; set; } 

public int PostePrecedentSelected { get; set; } 
public int PosteSuivantSelected { get; set; } 
private static Dictionary<string, Gamme> userGammes; 

public static Dictionary<string, Gamme> UserGammes 
{ 
get 
{ 
if (userGammes == null) 
{ 
userGammes = new Dictionary<string, Gamme>(); 
} 
return userGammes; 
} 
} 

} 
4

0 に答える 0