コード例 #1
0
ファイル: MessageServices.cs プロジェクト: densaw/ExampleCode
 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);
 }
コード例 #2
0
 public MessageViewModel Post(MessageViewModel message)
 {
     message.UserId = _userServices.GetUserByEmail(User.Identity.Name).Id;
     var newMessage = _messageServices.AddMessage(message);
     return _messageServices.ConvertToMessageViewModel(newMessage);
 }