public void SendNotificationFromUser(NotificationFromUser model) { var subject = String.Format("Nowa wiadomość od użytkownika: {0}", model.Title); var mesageContent = String.Format("{0} <br/> Id użytkownika: {1} <br/> Email użytkownika: {2}", model.MessageContent, model.UserId, model.UserEmail); mailSender.Send(model.UserEmail, "*****@*****.**", subject, mesageContent); }
public bool SendNotificationFromUser(string userId, string userEmail, NotificationFromUser model) { model.UserId = userId; model.UserEmail = userEmail; this.emailService.SendNotificationFromUser(model); return(true); }
private void SetupViews() { this.textViewAppVersion = FindViewById <TextView>(Resource.Id.textViewAppVersion); var version = this.ApplicationContext.PackageManager.GetPackageInfo(this.ApplicationContext.PackageName, 0).VersionName; this.textViewAppVersion.Text = String.Format("Wersja aplikacji: {0}", version); this.infoLayout = FindViewById <NestedScrollView>(Resource.Id.appInfoLayout); this.contactLayout = FindViewById <RelativeLayout>(Resource.Id.contactLayout); this.btnSendFeedback = FindViewById <Button>(Resource.Id.btnSendFeedback); this.btnSendFeedback.Click += (s, e) => { TogleLayouts(); }; this.btnSubmitSenInfo = FindViewById <Button>(Resource.Id.btnSubmitSenInfo); btnSubmitSenInfo.Click += async(s, e) => { if (selectedMessageTypeItemPosition == 0 && String.IsNullOrEmpty(telModel.Text)) { AlertsService.ShowShortToast(this, "Podaj model telefonu"); return; } if (String.IsNullOrEmpty(messageINfoContet.Text)) { AlertsService.ShowShortToast(this, "WprowadŸ treœæ wiadomoœci."); return; } progress.ShowProgressDialog("Wysy³anie zg³oszenia..."); var model = new NotificationFromUser(); model.Title = messageTypeStringContent; model.TelModel = this.telModel.Text; model.MessageContent = this.messageINfoContet.Text; progress.CloseProgressDialog(); var success = await this.feedbackService.SendNotificationFromUser(model); if (success) { AlertsService.ShowLongToast(this, "Zg³oszenie zosta³o wys³ane. Dziêkujemy."); ClearViews(); OnBackPressed(); } else { AlertsService.ShowShortToast(this, "Nie uda³o siê wys³aæ zg³oszenia."); } }; this.messageType = FindViewById <Spinner>(Resource.Id.messageType); this.telModel = FindViewById <EditText>(Resource.Id.telModel); this.messageINfoContet = FindViewById <EditText>(Resource.Id.messageINfoContet); SetupSpinner(); }
public IActionResult SendNotificationFromUser([FromBody] NotificationFromUser model) { try { var userId = this.identityService.GetUserId(User.Identity); bool result = this.feedbackService.SendNotificationFromUser(userId, User.Identity.Name, model); return(Json("ok")); } catch (Exception exc) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; logger.LogError("Wyst¹pi³ wyj¹tek w trakcie wysy³ania zg³oszenia od usera z formularza kontaktu: " + exc); return(Json("Wyst¹pi³ b³¹d! - " + exc.Message)); } }
public async Task <bool> SendNotificationFromUser(NotificationFromUser model) { var stringContent = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"); HttpResponseMessage response; try { response = await client.PostAsync(WebApiConsts.FEEDBACK_CONTROLLER + "SendNotificationFromUser/", stringContent); } catch { response = new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError); } if (response.StatusCode != System.Net.HttpStatusCode.OK) { return(false); } return(true); }