public async Task <CreatePrivateMessageCommandResponse> Handle(CreatePrivateMessageCommand command) { var person = _personRepository.AsQuery().SingleOrDefault(p => p.Id == command.PersonId); if (person == null) { throw new DomainException("شخص یافت نشد"); } var privateMessage = new PrivateMeassge(Guid.NewGuid(), command.Title, command.Body, new UserInfo(command.UserInfo.UserId, command.UserInfo.FirstName, command.UserInfo.LastName), command.PersonId); _repository.Add(privateMessage); var appType = person is Customer ? AppType.Customer : AppType.Shop; await _fcmNotification.SendToIds(person.GetPushTokens(), command.Title, command.Body, NotificationType.PrivateMessage, appType, NotificationSound.Default); return(new CreatePrivateMessageCommandResponse()); }
public static IPrivateMessageDto ToDto(this PrivateMeassge src) { return(Mapper.Map <IPrivateMessageDto>(src)); }