public void SearchAllEventEmails() { try { var events = repoEventCustomer.GetAllNonAsync().ToList(); if (events.Count() > 0 && events != null) { foreach (var p in events) { if (p.IsEmailSent == "N" && p.Status == "SUCCESSFULL" && p.TicketCategory != null && p.Retry < 2) { var res = SendEvent(p); EmailNotificationMail.SendEmailPlain(oGenericViewModel.tk_EventCustomers.Email, "Payment Receipt - " + oGenericViewModel.tk_EventCustomers.ReferenceNo, res, null, "*****@*****.**"); } p.IsEmailSent = "Y"; repoEventCustomer.Update(p); var retV = unitOfWork.CommitNonAsync(1) > 0 ? true : false; } } } catch (Exception) { throw; } }