Exemple #1
0
        public ActionResult PhucHoiMacDinh()
        {
            var oldData = _mailRepository.GetAll();

            foreach (var item in oldData)
            {
                _mailRepository.Delete(item.ID);
            }
            _mailRepository.SaveChange();
            var caiDat = new List <Mail>()
            {
                new Mail {
                    TenMail = "XacNhanDaDangKy.html", ValueOfMail = 0
                },
                new Mail {
                    TenMail = "fromAdmin.html", ValueOfMail = 1
                },
                new Mail {
                    TenMail = "changeRoom.html", ValueOfMail = 2
                },
                new Mail {
                    TenMail = "notAccept.html", ValueOfMail = 3
                },
                new Mail {
                    TenMail = "requestToAdmin.html", ValueOfMail = 4
                },
                new Mail {
                    TenMail = "toMembers.html", ValueOfMail = 5
                },
                new Mail {
                    TenMail = "*****@*****.**", ValueOfMail = 6
                },
                new Mail {
                    TenMail = "dung1997", ValueOfMail = 7
                }
            };

            foreach (var cd in caiDat)
            {
                _mailRepository.Add(cd);
            }
            _mailRepository.SaveChange();
            return(View("CaiDatThanhCong"));
        }
        //CADA VEZ QUE ENCONTREMOS UN EVENTO EN LA COLA DE TIPO DEPOSITCREATEDEVENT LO CAPTURARA ESTE MANEJADOR Y VA HACER UN REGISTRO EN LA BASE DE DATOS
        public Task Handle(NotificationCreatedEvent @event)
        {
            _mailRepository.Add(new SendMail()
            {
                SendDate  = DateTime.Now.ToShortDateString(),
                AccountId = @event.AccountId
            });

            return(Task.CompletedTask);
        }
Exemple #3
0
        public HttpResponseMessage Post(Mail mail)
        {
            bool isSuccessfulAdd = _mailRepository.Add(mail);

            if (!isSuccessfulAdd)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Exemple #4
0
 public Task Handle(NotificationCreatedEvent @event)
 {
     _iMailRepository.Add(new SendMail()
     {
         SendMailId = @event.IdOperation,
         InvoiceId  = @event.IdInvoice,
         SendDate   = DateTime.Now.ToShortDateString()
     });
     return(Task.CompletedTask);
 }
Exemple #5
0
        public IActionResult GetNotification([FromBody] SendMailDto request)
        {
            SendMail mail = new SendMail()
            {
                SendDate  = request.SendDate,
                AccountId = request.AccountId
            };

            _mailRepository.Add(mail);
            return(Ok());
        }
Exemple #6
0
        public IActionResult CreateNotification([FromBody] SendMailDto request)
        {
            SendMail mail = new SendMail()
            {
                SendDate  = request.SendDate,
                InvoiceId = request.InvoiceId
            };

            _mailRepository.Add(mail);
            return(Ok());
        }
Exemple #7
0
        public async Task <IActionResult> NewMail(NewMailViewModel model)
        {
            if (ModelState.IsValid)
            {
                var toUser = await _userManager.FindByNameAsync(model.UserName);

                if (toUser == null)
                {
                    ModelState.AddModelError(string.Empty, "Nie ma takiego gracza.");
                }
                else
                {
                    var user = await _userManager.GetUserAsync(User);

                    var receivedMail = new Mail()
                    {
                        FromId  = user.Id,
                        ToId    = toUser.Id,
                        Type    = MailType.Received,
                        Title   = model.Title,
                        Content = model.Content,
                        Status  = MailStatus.New
                    };
                    var sentMail = new Mail()
                    {
                        FromId  = user.Id,
                        ToId    = toUser.Id,
                        Type    = MailType.Sent,
                        Title   = model.Title,
                        Content = model.Content,
                        Status  = MailStatus.New
                    };

                    _mailRepository.Add(receivedMail);
                    _mailRepository.Add(sentMail);
                }
            }

            return(View(model));
        }
Exemple #8
0
        public void Add(MailDto mail)
        {
            //todo: fill another properties
            var mailTo = new MailTo
            {
                ToMailAddress = mail.ToEmailAddress,
                Message       = mail.Message,
                Subject       = mail.Subject,
                MailFrom      = new MailFrom
                {
                    SenderMailAddress = mail.SenderEmailAddress,
                    SenderPassword    = mail.SenderPassword
                }
            };

            _mailRepository.Add(mailTo);
        }
 public ResultMessage <Mail> Add(Mail data)
 {
     return(mailRepository.Add(data));
 }