c# - MVC5 repository and unitofwork pattern -
i trying implement search method: getcompte using account number , parametre could'nt response view!! don't know error
form:
@using (html.beginform("searchcompte", "compte", formmethod.post, new { @class = "form-horizontal", role = "form" })) { @html.antiforgerytoken() @html.validationsummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @html.label("numcompte", new { @class = "col-md-2 control-label" }) <div class="col-md-3"> @html.textbox("numcompte","", new { @class = "form-control", @placeholder = "n° compte" }) @html.validationmessage("numcompte", "", new { @class = "text-danger" }) </div> @html.label("clérib", new { @class = "col-md-1 control-label" }) <div class="col-md-2"> @html.textbox("clérib", "",new { @class = "form-control", @placeholder = "clé" }) @html.validationmessage("clérib", "", new { @class = "text-danger" }) </div> <div class=" col-md-2"> <input type="submit" name="search1" value="search" class="btn btn-primary" /> </div> </div>
controller:
[httpget]
public actionresult searchcompte() { //var compte = new compte(); //var cp = service.getcomptes(); return view(); } [httppost] [validateantiforgerytoken] public actionresult searchcompte(string numcompte,string clérib) { try { long num = convert.toint64(numcompte); var cp = service.getcompte(num); return view(cp); } catch (exception) { viewbag.message = " account doesn't exist"; return view(); } }
Comments
Post a Comment