Пример #1
0
        public ActionResult AddMessageAdmin(MessageViewModel messageModel)
        {
            List<string> errors;
            if (Session["val"] != null)
            {
                errors = ((string[])Session["val"]).ToList();
            }
            else
            {
                errors = new List<string>();
            }

            MessageDto messageDto = new MessageDto();

            messageDto.Content = messageModel.viewModel.Content;
            messageDto.Customer_Login = messageModel.viewModel.Customer_Login;
            messageDto.Sender_Login = messageModel.viewModel.Sender_Login;
            messageDto.Theme = messageModel.viewModel.Theme;
            messageDto.IfRead = messageModel.viewModel.Read.ToLower().Contains("tak") ? true : false;

            if(_messageService.AddMessageAdmin(messageDto))
            {
                errors.Add("Dodano wiadomość.");
            }
            else
            {
                errors.Add("Błąd. Spróbuj ponownie.");
            }
            Session["val"] = errors.ToArray<string>();

            return RedirectToAction("Admin");
        }
Пример #2
0
 public ActionResult HelpSupport(MessageViewModel model)
 {
     _userService.HelpMessage(model.viewModel.Email, model.viewModel.Content, model.viewModel.Theme);
     return RedirectToAction("Help");
 }
Пример #3
0
        public ActionResult _MessageList()
        {
            MessageViewModel messageModel = new MessageViewModel();

            messageModel.listModel = _messageService.GetMessage().Select(x => new ItemMessageViewModel
            {
                Content = x.Content,
                Customer_ID = x.Customer_ID,
                Customer_Login = x.Customer_Login,
                ID = x.ID,
                Read = x.IfRead ? "Tak" : "Nie",
                PostDate = x.PostDate,
                Sender_ID = x.Sender_ID,
                Sender_Login = x.Sender_Login,
                Theme = x.Theme
            }).ToList();

            messageModel.userList = _userService.GetUser().Select(x => x.Login).ToArray();

            return View(messageModel);
        }