コード例 #1
0
        // GET api/CodeJewels
        public IEnumerable <CodeJewelModel> GetCodeJewels()
        {
            DbCodeJewelsRepository codeJewelsRepository = this.allRepositories.GetCodeJewelRepository();
            var codeJewelsEntities = codeJewelsRepository.All();

            var codeJewelsModels =
                from codeJewelEntity in codeJewelsEntities
                select new CodeJewelModel()
            {
                CodeJewelId = codeJewelEntity.CodeJewelId,
                SourseCode  = codeJewelEntity.SourseCode,
                AuthorEmail = codeJewelEntity.AuthorEmail,
                Rating      = codeJewelEntity.Rating,
                CategoryId  = codeJewelEntity.CategoryId
            };

            return(codeJewelsModels.ToList());
        }