Esempio n. 1
0
 public ActionResult ComposeMail(MailDetailsModel mail)
 {
     if (ModelState.IsValid)
     {
         WriteLog(string.Format("Mail sent to {0}", mail.ToMailId));
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
        public IActionResult MailCompose(string title, string message, string[] taker)
        {
            MailModel        mailParent  = new MailModel();
            MailDetailsModel mailDetails = new MailDetailsModel();

            if (string.IsNullOrEmpty(taker.ToString()) || string.IsNullOrEmpty(message) || string.IsNullOrEmpty(title))
            {
                UserInfoListele();
                return(Json(new { result = false }));
            }
            else
            {
                var userSenderId = HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.Sid)
                                   .Select(c => c.Value)
                                   .SingleOrDefault();

                mailParent.Title      = title;
                mailParent.Message    = message;
                mailParent.Date       = DateTime.Now;
                mailParent.SenderID   = Guid.Parse(userSenderId);
                mailParent.MailStatus = MailDetailStatus.Silinmedi;
                var mailParentMessageInsert = MailRepo.NewInstance.Do.Insert(mailParent);

                mailDetails.MailParentID     = Guid.Parse(mailParentMessageInsert.ID.ToString());
                mailDetails.UserTakerID      = Guid.Parse(userSenderId);
                mailDetails.SenderStatus     = true;
                mailDetails.mailDetailStatus = MailDetailStatus.Okunmadi;

                var mailDetailsSenderFirstInsert = MailDetailsRepo.NewInstance.Do.Insert(mailDetails);

                mailDetails.MailParentID     = Guid.Parse(mailParentMessageInsert.ID.ToString());
                mailDetails.mailDetailStatus = MailDetailStatus.Okunmadi;
                var mailIDzero = new Guid();

                foreach (var item in taker)
                {
                    mailDetails.UserTakerID  = Guid.Parse(item);
                    mailDetails.SenderStatus = false;
                    var test = MailDetailsRepo.NewInstance.Do.Insert(mailDetails);
                    mailDetails.MailDetailsId = mailIDzero;
                }
                UserInfoListele();
                return(Json(new { result = true }));
            }
        }
Esempio n. 3
0
        public IActionResult MBInboxMes(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(View());
            }
            else
            {
                var usrEmail = HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.Email)
                               .Select(c => c.Value)
                               .SingleOrDefault();

                var userTakerId = HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.Sid)
                                  .Select(c => c.Value)
                                  .SingleOrDefault();

                ViewBag.userName_SurName = HttpContext.User.Identity.Name.ToString();
                ViewBag.userEmail        = usrEmail;

                ViewBag.loginList = UserLoginRepo.NewInstance.Get.ToList();

                MailDetailsModel currentAccount = MailDetailsRepo.NewInstance.Filter.MailDetailsId(Guid.Parse(id))
                                                  .Get.FirstOrDefault();

                var modelDetail = MailDetailsRepo.NewInstance.Group.Bilgi()
                                  .Group.MailveUserBilgileriIle()
                                  .Get.ToList();

                modelDetail = modelDetail.Where(x => x.UserTakerID == Guid.Parse(userTakerId) && x.MailDetailsId == Guid.Parse(id))
                              .OrderByDescending(x => x.Mails.Date).ToList();
                ViewBag.mailbilgi = modelDetail;

                var mailReadInfoCount = MailDetailsRepo.NewInstance.Filter.Takerid(new Guid(userTakerId))
                                        .Filter.SenderStatus(false)
                                        .Filter.MailDetailStatusUnRead()
                                        .Get.ToList().Count();
                ViewBag.readCount = mailReadInfoCount;
                if (currentAccount.mailDetailStatus == MailDetailStatus.Okunmadi)
                {
                    currentAccount.mailDetailStatus = MailDetailStatus.Okundu;
                    var test = MailDetailsRepo.NewInstance.Do.Update(currentAccount);
                }
                return(View("MBInboxMES"));
            }
        }