public Message AddMessage(MessageViewModel message) { var clubeId = _userServices.GetClubByUserName(_userRepository.GetById(message.UserId).Email).Id; var msg = new Message() { Image = message.Image, SendAt = DateTime.Now, Text = message.Message, UserId = message.UserId, ClubId = clubeId }; return _messageRepository.Add(msg); }
public MessageViewModel Post(MessageViewModel message) { message.UserId = _userServices.GetUserByEmail(User.Identity.Name).Id; var newMessage = _messageServices.AddMessage(message); return _messageServices.ConvertToMessageViewModel(newMessage); }