Esempio n. 1
0
        public IEnumerable <ProjectCommentViewModel> GetProjectComments(int projectId)
        {
            var models     = new List <ProjectCommentViewModel>();
            var coreModels = commentRepository.GetComments(projectId);

            foreach (var coreModel in coreModels)
            {
                models.Add(ProjectCommentMapper.MapProjectComment(coreModel));
            }

            //order by date descending
            return(models.OrderByDescending(c => c.Date).AsEnumerable());
        }
Esempio n. 2
0
        public ProjectCommentViewModel CreateProjectComment(ProjectCommentModel comment)
        {
            //map the incoming model to to a coreModel for insert
            var coreModel = ProjectCommentMapper.MapProjectCommentModel(comment);

            //insert the core model and return a core view
            var projectCommentView = commentRepository.CreateComment(coreModel);

            //map the core view to a model view
            var projectCommentViewModel = ProjectCommentMapper.MapProjectComment(projectCommentView);

            //return the model view
            return(projectCommentViewModel);
        }
Esempio n. 3
0
        public IEnumerable <ProjectCommentAreaModel> GetProjectCommentAreas()
        {
            var models     = new List <ProjectCommentAreaModel>();
            var coreModels = commentRepository.GetCommentAreas();

            int index = 1;

            foreach (var coreModel in coreModels)
            {
                models.Add(ProjectCommentMapper.MapProjectCommentArea(coreModel, index));
                index++;
            }

            return(models);
        }
Esempio n. 4
0
        public IEnumerable <ProjectCommentTypeModel> GetProjectCommentTypes(int projectId)
        {
            var coreModels = commentRepository.GetCommentTypes(projectId);

            return(ProjectCommentMapper.MapProjectCommentTypeModels(coreModels));
        }