title: How to update row in DataGrid after some time?
body: <p>I'll develop an application in WPF. The application reads emails from the clipboard, extracts certain data, saves it to DB and prints Alerts to <code>DataGrid</code>.
  My problem is that I want to update the Alert if an email arrives within 5 minutes (or some other specific time period) from the same sender and it will be the same problem. If no such Alert exists, it will simply be saved and a new one created. My problem is that the conditions in never true and will save Alerts only.
  Thank for any kind of advice.</p>
  <pre><code>for (int i = 0; i &lt; inbox.Count; i++)
                          {
                              var message = inbox.GetMessage(i, cancel.Token);
                              GetBodyText = message.TextBody;
                              Problem problem = new Problem(message.MessageId);
                             //Here I am avoiding to save duplicates
                              if (!dAOProblem.GetAll().Any(x =&gt; x.Message_Id.Equals(problem.Message_Id)))
                              {
                                  dAOProblem.Save(problem);
                                  Alert alert = new Alert(message.MessageId, message.Date.DateTime, message.From.ToString(), 1, problem.Id);
                                  if (!dAOAlert.GetAll().Any(x =&gt; x.Id_MimeMessage.Equals(alert.Id_MimeMessage)))
                                  {
                                     
                                      FindUpdate(alert);
                                      LoadAlertGrid();
                                  }
  
                              }
  </code></pre>
  <blockquote>
  <p>Method for Updating Alert or saving</p>
  </blockquote>
  <pre><code>public void FindUpdate(Alert alert)
          {
              double result = 0; 
              if (dAOAlert.GetAll().Any(x =&gt; x.Email.Equals(alert.Email)) &amp;&amp; dAOAlert.GetAll().Any(x =&gt; x.Problem.NameOfAlert.Equals(alert.Problem.NameOfAlert))) 
              {
                  var list = dAOAlert.GetAll().ToList();
                  for (int i = 0; i &lt; dAOAlert.GetAll().Count(); i++)
                  {
                      result = alert.Date.Minute - list[i].Date.Minute ;
                      if (result &gt; 0 &amp;&amp; result &lt;= 5)
                      {
                          dAOAlert.Update(alert); 
                          LoadAlertGrid();
                          MessageBox.Show(&quot;Alert has been updated&quot;);
                          break;
                      }
                      else
                      {
                          dAOAlert.Save(alert);
                          LoadAlertGrid();
                      }
                  }
              }
          }
  </code></pre>