Do you avoid putting business logic into the presentation layer?
Loading last updated info...
Be sure you are aware of what is business logic and what isn't. Typically, looping code will be placed in the business layer. This ensures that no redundant code is written and other projects can reference this logic as well.
private void btnOK_Click(object sender, EventArgs e){rtbParaText.Clear();var query =from p in dc.GetTable()select p.ParaID;foreach (var result in query){var query2 =from t in dc.GetTable()where t.ParaID == resultselect t.ParaText;rtbParaText.AppendText(query2.First() + "\r\n");}}
❌ Figure: Bad Example: A UI method mixed with business logics
private void btnOK_Click(object sender, EventArgs e){string paraText = Business.GetParaText();rtbParaText.Clear();rtbParaText.Add(paraText);}
✅ Figure: Good Example : Putting business logics into the business project, just call the relevant method when needed