Exemple #1
0
        public static async System.Threading.Tasks.Task SendMailAsync(string subject, string body, int?projectId, int?itemId, string toEmail)
        {
            if (projectId != null)
            {
                var projectSubs = new EfProjectSubcribersRepository().GetProjectSubscribersOrNull(Convert.ToInt32(projectId));

                foreach (var sub in projectSubs)
                {
                    await SendMailAsync(subject, body, sub.Email);
                }
            }

            if (itemId != null)
            {
                var itemSubs = new EfItemSubcribersRepository().GetItemSubscribersOrNull(Convert.ToInt32(itemId));

                foreach (var sub in itemSubs)
                {
                    await SendMailAsync(subject, body, sub.Email);
                }
            }

            if (!string.IsNullOrEmpty(toEmail))
            {
                await SendMailAsync(subject, body, toEmail);
            }
        }
Exemple #2
0
        public IViewComponentResult Invoke(string id)
        {
            var users = new EfItemSubcribersRepository().GetItemSubscribersOrNull(Convert.ToInt32(id));

            if (users == null)
            {
                return(null);
            }

            return(View(users));
        }