/* Get Mails */
        public async Task<List<CMail>> GetMails()
        {
            /* Create list */
            List<CMail> lMails = new List<CMail>();
            
            /* Query */
            var MailCheck = await (from Obj in Database.Mails
                                   select Obj).ToListAsync();

            /* Iterate */
            foreach (Mail gMail in MailCheck)
            {
                /* Allocate & Convert */
                CMail nMail = new CMail();
                nMail.Id = gMail.Id;
                nMail.Type = (MailType)gMail.Type;
                nMail.MailTo = gMail.MailTo;
                nMail.Subject = gMail.Subject;
                nMail.Body = gMail.Body;
                nMail.IsHtml = gMail.Html;

                /* Add */
                lMails.Add(nMail);
            }

            /* Done! */
            return lMails;
        }
Пример #2
0
 public async Task<OpObject> SendMail(CMail Mail)
 {
     IsolatedContext IsoContext = new IsolatedContext();
     return await Execute(new Func<Task>(async () =>
     {
         /* Oh no, problem is STService Town, contact the organization repo */
         using (MaintienceRepository MainRepo = new MaintienceRepository())
         {
             /* Well then, lets try to create this organization */
             IsoContext.RetObj = await MainRepo.InsertMail(Mail);
         }
     }), IsoContext);
 }
        /* Insert Mail */
        public async Task<OpObject> InsertMail(CMail gMail)
        {
            /* Proxy Datatype */
            Mail nMail = new Mail()
            {
                Type = (int)gMail.Type,
                MailTo = gMail.MailTo,
                Subject = gMail.Subject,
                Body = gMail.Body,
                Html = gMail.IsHtml
            };

            /* Insert */
            Database.Mails.Add(nMail);

            /* Mark as added */
            Database.Entry(nMail).State = System.Data.Entity.EntityState.Added;

            /* Save */
            await Database.SaveChangesAsync();

            /* Done! */
            return new OpObject(StatusCode.Ok);
        }