public async Task <ActionResult> Send(string username, MassageViewModel model)
        {
            var user = await this.userRepository.GetUserByNameAsync(username);

            model.NewMessage.FromId = UserLoginId;
            model.NewMessage.ToId   = user.Id;

            var result = await this.messageService.SendMessage(user.Id, model.NewMessage);

            if (!result)
            {
                return(RedirectToAction("ChatIndex", "Message", new { username = username }));
            }

            MessageHub.NotifyCurrentEmployeeInformationToAllClients();

            return(RedirectToAction("ChatIndex", "Message", new { username = username }));
        }
        public MassageViewModel GetMessageModel(IEnumerable <Massage> income, IEnumerable <Massage> outcome)
        {
            MassageViewModel models = new MassageViewModel();

            foreach (var item in income)
            {
                var model = new Massage();
                model             = item;
                model.MassageType = MessageType.Income;
                models.Massages.Add(model);
            }

            foreach (var item in outcome)
            {
                var model = new Massage();
                model             = item;
                model.MassageType = MessageType.Outcome;
                models.Massages.Add(model);
            }

            return(models);
        }