Do you avoid putting business logic into the presentation layer?
27/04/2018 8:28 AM by
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) Bad Example: A UI method mixed with business logics
var query =
from p in dc.GetTable()
foreach (var result in query)
var query2 =
from t in dc.GetTable()
where t.ParaID == result
rtbParaText.AppendText(query2.First() + "\r\n");
private void btnOK_Click(object sender, EventArgs e)Good Example : Putting business logics into the business project, just call the relevant method when needed
string paraText = Business.GetParaText();
Do you feel this rule needs an update?