コード例 #1
0
 //
 // GET: /Templates/
 public ActionResult Reminder()
 {
     var data = new EmailReminderData
     {
         FullName = "Jalla",
         Reminders = new List<Reminder> {
         new Reminder { ProjectTitle="MyProject1", LastNoteText="Last note text", Due=DateTime.Now },
         new Reminder { ProjectTitle="MyProject2", LastNoteText="Last note text", Due=DateTime.Now }
     }
     };
     return View(data);
 }
コード例 #2
0
        public List<EmailReminderData> ComposeMessages(IList<Reminder> reminders)
        {
            var q = reminders.GroupBy(x => x.UserId);
            var retVal = new List<EmailReminderData>();
            foreach (var item in q)
            {
                var u = RavenSession.Load<User>(item.First().UserId);
                var toAdd = new EmailReminderData { Reminders = new List<Reminder>(), FullName = u.FullName, Email = u.Email };
                foreach (var reminder in item)
                {
                    toAdd.Reminders.Add(reminder);
                }
                //var template = Template.Compile(File.ReadAllText(TemplateRootPath + "Reminder.cshtml"));
                //toAdd.HtmlBodyString = template.Render( toAdd);
                toAdd.HtmlBodyString = Razor.Parse(File.ReadAllText(TemplateRootPath + "Reminder.cshtml"), toAdd);
                retVal.Add(toAdd);
            }

            return retVal;
        }