예제 #1
0
		public async Task<ActionResult> LogEventSubscriptions()
		{
			var dbContext = new NotificationDb();
			var logEventSub = new LogEventSubscriptions
			{
				Id = Guid.NewGuid(),
				ObjectTypeOfEvent = Enum.ObjectTypeOfEvent.MonthlyMeeting,
				EventType = Enum.EventType.Delete,
				UserWhoSubscribed = "*****@*****.**"
			};

			dbContext.LogEventSubscriptionses.Add(logEventSub);
			await dbContext.SaveChangesAsync();
			return Content("Created new row");
		}
예제 #2
0
        public static void ProcessQueueMessage([QueueTrigger("logeventslog")] LogEvents logEvent, TextWriter log)
        {
            var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());
            var blobClient = storageAccount.CreateCloudBlobClient();

            var dbContext = new NotificationDb();

            List<string> c = dbContext.LogEventSubscriptionses.Where(r => r.EventType == logEvent.EventType
                             && r.ObjectTypeOfEvent == logEvent.ObjectTypeOfEvent)
                             .Select(r => r.UserWhoSubscribed).ToList();

            var y = new LogEventSubscriptions()

            {
                UserWhoSubscribed = "*****@*****.**",
                Id = Guid.NewGuid()
            };

            dbContext.LogEventSubscriptionses.Add(y);
            dbContext.SaveChanges();

            //var mandrill = new MandrillApi(ConfigurationManager.AppSettings["MandrillApiKey"]);

            //foreach (var row in c)
            //{
            //	var email = new EmailMessage
            //	{
            //		Text = "body",
            //		FromEmail = "*****@*****.**",
            //		To = new List<EmailAddress> { new EmailAddress { Email = row } },
            //		Subject = "Sub"
            //	};

            //	 mandrill.SendMessage(new SendMessageRequest(email));
            //}
        }