示例#1
0
        public ActionResult SendMailForPatient()
        {
            var doctorsIDsNames = GetNamesOfDoctors();

            var model = new MailFromPatientViewModel
            {
                NamesOfDoctors = doctorsIDsNames
            };

            return(View(model));
        }
示例#2
0
        public async Task <ActionResult> SendMailForPatient(MailFromPatientViewModel model)
        {
            if (ModelState.IsValid)
            {
                var    receiverID = UserManager.Users.FirstOrDefault(x => x.user_info_id == model.Receiver).Id;
                string title      = "Wiadomość od: " + CurrentUserName + ". Tytuł: " + model.Title;
                await UserManager.SendEmailAsync(receiverID, title, model.Body);

                TempData["Success"] = "Wysłano wiadomość.";
            }
            else
            {
                TempData["Warning"] = "Wystąpił błąd podczas wysyłania maila. Proszę sprobować jeszcze raz.";
            }

            return(RedirectToAction("SendMailForPatient"));
        }