コード例 #1
0
        public UserDTO GetUserById(string userId)
        {
            User user = userProfile.GetUserById(userId);

            return(user != null
                ? converterToDTO.ConvertToUserDTO(user)
                : throw new ArgumentNullException());
        }
コード例 #2
0
        ////public int GetDeckStatistics(int deckId)
        ////{
        ////    var deckStatistics = moderation.GetDeckStatistics(deckId).ToList();
        ////    int result = 0;
        ////    if (deckStatistics.Count > 0)
        ////    {
        ////        double totalDeckPercent = 0.0;
        ////        foreach (Statistics statistic in deckStatistics)
        ////        {
        ////            totalDeckPercent += statistic.SuccessPercent;
        ////        }
        ////        result = Convert.ToInt32(
        ////            Math.Round(totalDeckPercent / deckStatistics.Count));
        ////    }

        ////    return result;
        ////}

        ////public int GetStatistics(string deckName, int userId)
        ////{
        ////    Statistics statistics = moderation.GetStatistics(deckName, userId);

        ////    return statistics != null ? statistics.SuccessPercent : 0;
        ////}

        ////public void DeleteStatistics(int statisticsId)
        ////{
        ////    moderation.DeleteStatistics(statisticsId);
        ////}

        #endregion

        #region ForUserBy

        public List <UserDTO> GetAllUsersByCourse(int courseId)
        {
            List <User>    users    = moderation.GetAllUsersByCourse(courseId).ToList();
            List <UserDTO> usersDTO = new List <UserDTO>();

            foreach (var user in users)
            {
                usersDTO.Add(converterToDTO.ConvertToUserDTO(user));
            }

            return(usersDTO);
        }