Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to declare the variable correctly?
Message
 
 
À
17/04/2013 11:35:31
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01553872
Message ID:
01571411
Vues:
34
>The where function just takes your entity as a parameter and you return a boolean result. If you want no results you just return false:
operators = operators.Where(o => false));
>As for changing the type of the id, can't you just change the controller to accept string in place of int?

This doesn't seem to work for me.

Here is the code I have in my js file:
var url = '/Operator/Edit/' + id;

   $.get(url, function (html) {
      $($dlg).html(html);
   });

   RunModalDialog("Edit Operator: " + fullName);
So, the url variable is correct '/Operator/Edit/ADMIN ' (space at the end - could it be a problem)?

However, I get code NULL in this code
// GET: /Operator/Edit/Admin
      [HttpGet]
      public ActionResult Edit(String code)
      {
         var oOperator = Db.GetOperatorByCode(code);
         OperatorViewModel model = new OperatorViewModel(oOperator);

         return PartialView("_OperatorForm", model);
      }
UPDATE. Never mind, I should have named the parameter id here, not code.

It works now.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform