public List <AnswerBL> GetAll(int id) { var answersOrdered = new List <AnswerBL>(); DALToBLMapper poMapper = new DALToBLMapper(); List <Answer> answers = DAL.SDK.Kit.Instance.Answers.GetAnswers(id); List <AnswerBL> mappedAnswers = poMapper.MapAnswerCollection(answers).ToList(); if (answers.Count > 0) { var corrects = answers.Where(c => c.Flags == DAL.Entities.AnswerFlags.Correct).ToList(); if (corrects.Count() > 0) { int correctId = 0; correctId = corrects.First().Id; if (correctId != 0) { //this is not good but is needed var correctAnswer = mappedAnswers.Where(c => c.Id == correctId).First(); correctAnswer.Flag = Entities.AnswerFlags.Correct; answersOrdered.Add(correctAnswer); answersOrdered.AddRange(mappedAnswers.Where(c => c.Id != correctId)); return(answersOrdered); } } } return(mappedAnswers); }
public List <SubCategoryBL> GetAllByCategoryId(int categoryId) { DALToBLMapper poMapper = new DALToBLMapper(); List <SubCategory> subCategories = DAL.SDK.Kit.Instance.SubCategories.GetAllByCategoryId(categoryId); List <SubCategoryBL> mappedSubCategories = poMapper.MapSubCategoryCollection(subCategories).ToList(); return(mappedSubCategories); }
public List <CategoryBL> GetAll() { DALToBLMapper poMapper = new DALToBLMapper(); List <Category> categories = DAL.SDK.Kit.Instance.Categories.GetAll(); List <CategoryBL> mappedCategories = poMapper.MapCategoryCollection(categories).ToList(); return(mappedCategories); }
public List <QuestionBL> GetBySubcategoryId(int subcategoryId) { DALToBLMapper poMapper = new DALToBLMapper(); List <Question> questions = DAL.SDK.Kit.Instance.Questions.GetQuestionsBySubcategoryId(subcategoryId); List <QuestionBL> mappedQuestion = poMapper.MapQuestionCollection(questions).ToList(); return(mappedQuestion); }
public List <QuestionBL> GetByUserId(int userI) { DALToBLMapper poMapper = new DALToBLMapper(); List <Question> questions = DAL.SDK.Kit.Instance.Questions.GetByUserId(userI); List <QuestionBL> mappedQuestion = poMapper.MapQuestionCollection(questions).ToList(); return(mappedQuestion); }
public List <QuestionBL> ContributedBy(int userId) { DALToBLMapper poMapper = new DALToBLMapper(); List <Question> questions = DAL.SDK.Kit.Instance.Questions.ContributedBy(userId); List <QuestionBL> mappedQuestion = poMapper.MapQuestionCollection(questions).ToList(); return(mappedQuestion); }
public EmailTemplateBL GetByName(string emailTemplateName) { DALToBLMapper poMapper = new DALToBLMapper(); EmailTemplate emailTemplate = DAL.SDK.Kit.Instance.EmailTemplates.GetEmailTemplateByName(emailTemplateName); EmailTemplateBL mappedEmailTemplate = poMapper.MapEmailTemplate(emailTemplate); return(mappedEmailTemplate); }
public List <ArticleBL> GetAll() { DALToBLMapper poMapper = new DALToBLMapper(); List <Article> articles = DAL.SDK.Kit.Instance.Articles.GetAll(); List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList(); return(mappedArticles); }
public ArticleBL Get(int id) { DALToBLMapper poMapper = new DALToBLMapper(); Article article = DAL.SDK.Kit.Instance.Articles.GetArticleById(id); ArticleBL mappedArticle = poMapper.MapArticle(article); return(mappedArticle); }
public List <QuestionBL> GetAll() { DALToBLMapper poMapper = new DALToBLMapper(); List <Question> questions = DAL.SDK.Kit.Instance.Questions.GetAll(); List <QuestionBL> mappedQuestions = poMapper.MapQuestionCollection(questions).ToList(); return(mappedQuestions); }
public UserBL GetById(int id) { DALToBLMapper poMapper = new DALToBLMapper(); User user = DAL.SDK.Kit.Instance.Users.GetUserById(id); UserBL mappedUser = poMapper.MapUser(user); return(mappedUser); }
public List <CommentBL> GetAll(int articleId) { DALToBLMapper poMapper = new DALToBLMapper(); List <Comment> comment = DAL.SDK.Kit.Instance.Comments.GetCommentsByArticleById(articleId); List <CommentBL> mappedComments = poMapper.MapCommentCollection(comment).ToList(); return(mappedComments); }
public List <UserBL> GetAll() { DALToBLMapper poMapper = new DALToBLMapper(); List <User> users = DAL.SDK.Kit.Instance.Users.GetAll(); List <UserBL> mappedUsers = poMapper.MapUserCollection(users).ToList(); return(mappedUsers); }
public UserBL GetByEmail(string email) { DALToBLMapper poMapper = new DALToBLMapper(); User user = DAL.SDK.Kit.Instance.Users.GetUserByEmail(email); UserBL mappedUser = poMapper.MapUser(user); return(mappedUser); }
public ArticleBL GetByCommentId(int questionId) { DALToBLMapper poMapper = new DALToBLMapper(); Article article = DAL.SDK.Kit.Instance.Articles.GetArticleByCommentId(questionId); ArticleBL mappedArticle = poMapper.MapArticle(article); return(mappedArticle); }
public QuestionBL Get(int id) { DALToBLMapper poMapper = new DALToBLMapper(); Question questions = DAL.SDK.Kit.Instance.Questions.GetQuestionById(id); QuestionBL mappedQuestion = poMapper.MapQuestion(questions); return(mappedQuestion); }
public List <CommentBL> GetWithUsers(int articleId) { DALToBLMapper poMapper = new DALToBLMapper(); List <Comment> comments = DAL.SDK.Kit.Instance.Comments.GetCommentsByArticleById(articleId); for (int i = 0; i < comments.Count(); i++) { comments[i].User = DAL.SDK.Kit.Instance.Users.GetUserById(comments[i].IdUser); } List <CommentBL> mappedComments = poMapper.MapCommentCollection(comments).ToList(); return(mappedComments); }
public List <ArticleBL> GetBySubcategoryId(int SubcategoryId) { DALToBLMapper poMapper = new DALToBLMapper(); List <Article> articles = DAL.SDK.Kit.Instance.Articles.GetArticlesBySubcategoryId(SubcategoryId); for (int i = 0; i < articles.Count(); i++) { articles[i].Comments = DAL.SDK.Kit.Instance.Comments.GetCommentsByArticleById(articles[i].Id); } List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList(); return(mappedArticles); }
public List <QuestionBL> GetLatests(int nr) { DALToBLMapper poMapper = new DALToBLMapper(); List <Question> questions = DAL.SDK.Kit.Instance.Questions.GetLatestQuestions(nr); for (int i = 0; i < questions.Count(); i++) { questions[i].Answers = DAL.SDK.Kit.Instance.Answers.GetAnswers(questions[i].Id); questions[i].Title = questions[i].Title.GetLiteralAndNumericalFromString(); } List <QuestionBL> mappedQuestion = poMapper.MapQuestionCollection(questions).ToList(); return(mappedQuestion); }
public List <ArticleBL> GetLatests(int nr) { DALToBLMapper poMapper = new DALToBLMapper(); List <Article> articles = DAL.SDK.Kit.Instance.Articles.GetLatestsArticles(nr); for (int i = 0; i < articles.Count(); i++) { articles[i].Comments = DAL.SDK.Kit.Instance.Comments.GetCommentsByArticleById(articles[i].Id); articles[i].Title = articles[i].Title.GetLiteralAndNumericalFromString(); } List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList(); return(mappedArticles); }
public List <ArticlesPerMonth> GetAllByMonth() { DALToBLMapper poMapper = new DALToBLMapper(); List <Article> articles = DAL.SDK.Kit.Instance.Articles.GetAll(); List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList(); var orderedArticles = mappedArticles.OrderBy(date => date.CreatedDate).ToList(); List <ArticlesPerMonth> articlesperMonthArray = new List <ArticlesPerMonth>(); List <ArticleBL> listArticle = new List <ArticleBL>(); var month = 0; int year = 0; foreach (var item in mappedArticles) { if (year < item.CreatedDate.Year || month < item.CreatedDate.Month) { if (listArticle.Count > 0) { articlesperMonthArray.Add(new ArticlesPerMonth() { articles = listArticle, Month = month, Year = year }); } listArticle = new List <ArticleBL>(); } listArticle.Add(item); year = item.CreatedDate.Year; month = item.CreatedDate.Month; } articlesperMonthArray.Add(new ArticlesPerMonth() { articles = listArticle, Month = month, Year = year }); return(articlesperMonthArray); }