asp.net mvc - OnValidate VB.Net partial method wont fire for NerdDinner sample code -


I have a problem that said it was, but then said that he has decided it. & Nbsp; I saw this post and what did it do to implement it, but it still does not work for me (if Gwachzal sees it, then I want to see his code)

To begin, I want to create a business rule that is different from the DAL code generated by my L2S model. & Nbsp; For example, NerdDinner (which is written in C #) this code should be in the classical class like below for my sake.

If someone can help me tell partial class in my controller class code, I

   Beval preorder to preorder) as ActionResult if it is ModelState.IsValid, then order it again before order. Registration ID = GetRegistrationID () db.PreOrders.InsertOnSubmit (preOrderToCreate) db.SubmitChanges () Return Redirect Detection ("Index") Pre-order for each issue. Gettyrell violation () ModelState Adoldmodl (issue. Property name issue. Arroresej) Explore further and tree and if Popyuletdaupdaunlistboks Forekt in () Create return View ( "") End Function Sub Populetdaupdaunlistbokssfor cut () Dim goods = db.Merchandises.ToList () ViewData ( " MerchandiseID ") = New selectList (Business," ID "," Descr ") End Sub Import System.Data.Linq Partial Public Class Preorder People ReadOnly property if () Get Refund in the form of Boolean (GetRuleViolations). ) = 0) Get Ended Property Public Function GetRuleViolations () IEnumerable (RuleViolation) Retired Retirement = New List (RuleViolation) (if not) IsNumeric (quantity) then ret.Add (New RuleViolation ("Quantity", "Quantity is not numerical ")) So retired retired expiration ceremony 'is not getting it said. Private Sub OnValidate (ByVal action if not as ChangeAction) if then throw new ApplicationException ( "Rule violations prevent saving") End If End Sub End Class  

I have found it (more or less). I followed the order of the two parameters ...

  ret.Add (new rule violation ( "volume", "volume is not numeric"))  

should

  ret.Add (new RuleViolation ( "volume numerical", "volume"))  

I fill still I I fully understand it. Oh fine.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -