private void ConfirmRental(MessageFromRenterModel renterMessage, bool rentalConfirmed)
        {
            if (renterMessage.ConfirmationStatus != MsgStatus.Unhandled)
            {
                return;
            }

            DeclineButton ^= rentalConfirmed;
            ConfirmButton  = rentalConfirmed;
            NotificationMessage.Confirmation = rentalConfirmed ? MsgStatus.Confirmed : MsgStatus.Declined;
            renterMessage.ConfirmationStatus = rentalConfirmed ? MsgStatus.Confirmed : MsgStatus.Declined;
            _eventAggregator.GetEvent <NotificationConfirmationEvent>().Publish(renterMessage);
        }
Пример #2
0
        public async Task AddMessageToLessor(string mes, CarProfileModel carProfile, UserModel renter)
        {
            using (var db = _dbContextFactory.GetContext())
            {
                var message = new MessageFromRenterModel(renter, carProfile.Owner, carProfile, mes)
                {
                    Sender    = renter,
                    Receiver  = carProfile.Owner,
                    TimeStamp = DateTime.Now
                };
                var dbMessage = _appToDbModelConverter.Convert(message);

                await db.AddMessage(dbMessage);
            }
        }
Пример #3
0
        private MessageFromLessorModel CreateResponseForRenter(MessageFromRenterModel messageToRespondTo)
        {
            var contactInfo = messageToRespondTo.ConfirmationStatus == MsgStatus.Confirmed
                ? $"Please contact me on my email: {messageToRespondTo.Lessor.Email}" : "";
            var msg = $"I {messageToRespondTo.ConfirmationStatus.ToString()} your request. " + contactInfo;

            return(new MessageFromLessorModel(messageToRespondTo.Renter, messageToRespondTo.Lessor,
                                              messageToRespondTo.RentCar, msg, messageToRespondTo.ConfirmationStatus)
            {
                Sender = messageToRespondTo.Lessor,
                Receiver = messageToRespondTo.Renter,
                MsgType = MessageType.LessorMessage,
                TimeStamp = DateTime.Now,
            });
        }