示例#1
0
        public void CreateNatificationForFight(int attackerUserId, int attackerCharId, int targetUserId, int targetCharId, string fightTime)
        {
            var notification = new NotificationDbEntity
            {
                AttackerUser = _userRepository.GetById(attackerUserId),
                AttackerChar = _charRepository.GetById(attackerCharId),
                TargetUser   = _userRepository.GetById(targetUserId),
                TargetChar   = _charRepository.GetById(targetCharId),
                FightTime    = Convert.ToDateTime(fightTime),
                IsRead       = false
            };

            _notificationRepository.Add(notification);
        }
        public static NotificationDbEntity Build(this Notification notificationDbEntity)
        {
            NotificationDbEntity n = new NotificationDbEntity
            {
                AttackerUser = Build(notificationDbEntity.AttackerUser),
                TargetUser   = Build(notificationDbEntity.TargetUser),
                AttackerChar = Build(notificationDbEntity.AttackerChar),
                TargetChar   = Build(notificationDbEntity.TargetChar),
                FightTime    = notificationDbEntity.FightTime,
                IsRead       = notificationDbEntity.IsRead
            };

            return(n);
        }