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()); }
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); }
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); }
public IEnumerable <ProjectCommentTypeModel> GetProjectCommentTypes(int projectId) { var coreModels = commentRepository.GetCommentTypes(projectId); return(ProjectCommentMapper.MapProjectCommentTypeModels(coreModels)); }