Exemplo n.º 1
0
        async Task ShellSaveFeedback()
        {
            Response.ContentType = "application/json";
            try
            {
                String json = null;
                using (var tr = new StreamReader(Request.InputStream))
                {
                    json = tr.ReadToEnd();
                }
                var model = JsonConvert.DeserializeObject <SaveFeedbackModel>(json);
                model.UserId = this.UserId;
                await _baseController.SaveFeedback(model);

                Response.Output.Write($"{{\"status\": \"OK\"}}");

                var context     = HttpContext.GetOwinContext();
                var userManager = context.GetUserManager <AppUserManager>();
                var appUser     = userManager.FindById(this.UserId);

                String text = $"UserId: {appUser.Id}<br>UserName: {appUser.PersonName}<br>Login: {appUser.UserName}<br></br><p>{model.Text}</p>";
                await _baseController.SendSupportEMailAsync(text);
            }
            catch (Exception ex)
            {
                WriteExceptionStatus(ex);
            }
        }