public IEnumerable <VideoDto> GetVideosWithCategory(string category, int pageIndex, int pageCount, out int count) { var result = _videoRepository.GetPagedWithFilter(v => v.Category.Contains(category), pageIndex, pageCount, out count, v => v.CreateTime, false); return(QsMapper.CreateMapIEnume <Video, VideoDto>(result)); }
public IEnumerable <RecentActivityDto> GetAllRecentActivitys() { var allRecentActivity = _activityRepository.GetAll().OrderByDescending(n => n.StartTime).AsEnumerable(); //var allRecentActivity = _activityRepository.GetAll().OrderByDescending(n => n.IsTop).ThenByDescending(n => n.CreateTime).AsEnumerable(); return(QsMapper.CreateMapIEnume <RecentActivity, RecentActivityDto>(allRecentActivity)); }
public IEnumerable <BookDto> GetRandomBooks(int num = 6) { var sql = String.Format("SELECT TOP {0} * FROM Book ORDER BY NewID()", num); var results = _bookRepository.ExecuteQuery(sql); return(QsMapper.CreateMapIEnume <Book, BookDto>(results)); }
public IEnumerable <SuggestionDto> GetAllSuggestions() { var allSuggestion = _suggestionRepository.GetAll().OrderByDescending(n => n.CreateTime).AsEnumerable(); //var allSuggestion = _suggestionRepository.GetAll().OrderByDescending(n => n.IsTop).ThenByDescending(n => n.CreateTime).AsEnumerable(); return(QsMapper.CreateMapIEnume <Suggestion, SuggestionDto>(allSuggestion)); }
public ActionResult Personal([Bind(Exclude = "RealName, StuNumber, Identification")] AcntWithoutPsw userAcnt) { var result = new QsResult { Success = false }; if (ModelState.IsValid) { var userInCookie = CustomAuthorizeAttribute.GetUser(); if (userAcnt.UserId != userInCookie.UserId) { result.Message = @"请不要尝试修改您不允许改动的内容"; return(Json(result)); } var original = _userService.GetUserById(userInCookie.UserId); if (TryUpdateModel(original, null, null, new [] { "RealName", "StuNumber", "Identification", "Roles" })) { _userService.UpdateUserInformation(original); SafeOutAuthCookie(); SetAuthCookie(QsMapper.CreateMap <UserDto, UserSafetyModel>(original)); result.Success = true; return(Json(result)); } } return(Json(result)); }
public IEnumerable <MyMessageDto> GetAllMyMessages() { var allMyMessage = _myMessageRepository.GetAll().OrderByDescending(n => n.RecentTime).AsEnumerable(); //var allMyMessage = _myMessageRepository.GetAll().OrderByDescending(n => n.IsTop).ThenByDescending(n => n.CreateTime).AsEnumerable(); return(QsMapper.CreateMapIEnume <Core.Module.MyMessage, MyMessageDto>(allMyMessage)); }
public ActionResult Confirmation(AccountModel model) { var userDto = CustomAuthorizeAttribute.GetUser(); if (ModelState.IsValid) { var initUser = _userService.GetUserById(userDto.UserId); if (TryUpdateModel(initUser, null, null, new[] { "UserId", "RealName", "StuNumber", "Identification", "State", "PhotoUrl", "Roles" })) { if (initUser.State == UserState.Activated || initUser.State == UserState.Retire) { ModelState.AddModelError("duplicate", @"用户的状态出现错误:" + initUser.State); } else { //将用户状态设为激活状态,此种情况下才能执行查看其他页面 initUser.State = UserState.Activated; if (!String.IsNullOrEmpty(model.Password)) { initUser.Password = Utilities.MD5(model.Password); } _userService.UpdateUserInformation(initUser); SafeOutAuthCookie(); SetAuthCookie(QsMapper.CreateMap <UserDto, UserSafetyModel>(initUser)); return(Content("<script>alert('填写成功!');window.location='/Account/ProfileDetail'</script>")); } } } BindSelectListDataSource((int)userDto.Gender); return(View(model)); }
public void AddBookComment(BookCommentDto commentDto) { _bookRepository.Add(QsMapper.CreateMap <BookCommentDto, BookComment>(commentDto)); _bookRepository.UnitOfWork.Commit(); IncreaseCommentNumsOf("Book", commentDto.BookId); var sb = new StringBuilder(); var type = string.Empty; switch (commentDto.ReadStatus) { case (ReadStatus.Wish): { break; } case (ReadStatus.Reading): { break; } case (ReadStatus.Already): { break; } } if (commentDto.ReadStatus != ReadStatus.Wish && commentDto.Score > 0) { } }
public void AddUser(UserDto userDto) { User user = QsMapper.CreateMap <UserDto, User>(userDto); _userRepository.Add(user); _userRepository.UnitOfWork.Commit(); }
public IEnumerable <AtlasDto> GetRandomAtlases(int num = 8) { var sql = String.Format("SELECT TOP {0} * FROM Atlas ORDER BY NewID()", num); var results = _atlasRepository.ExecuteQuery(sql); return(QsMapper.CreateMapIEnume <Atlas, AtlasDto>(results)); }
public IEnumerable <ArticleDto> GetAllArticles() { var allArticle = _articleRepository.GetAll().OrderByDescending(n => n.CreateTime).AsEnumerable(); //var allArticle = _articleRepository.GetAll().OrderByDescending(n => n.IsTop).ThenByDescending(n => n.CreateTime).AsEnumerable(); return(QsMapper.CreateMapIEnume <Article, ArticleDto>(allArticle)); }
public IEnumerable <NewsDto> GetAllNews() { var allNews = _newsRepository.GetAll().OrderByDescending(n => n.CreateTime).AsEnumerable(); //var allNews = _newsRepository.GetAll().OrderByDescending(n => n.IsTop).ThenByDescending(n => n.CreateTime).AsEnumerable(); return(QsMapper.CreateMapIEnume <News, NewsDto>(allNews)); }
public IEnumerable <TagDto> GetAllTags() { var allTag = _tagRepository.GetAll().OrderByDescending(n => n.TagSum).AsEnumerable(); //var allTag = _tagRepository.GetAll().OrderByDescending(n => n.IsTop).ThenByDescending(n => n.CreateTime).AsEnumerable(); return(QsMapper.CreateMapIEnume <Core.Module.Tag, TagDto>(allTag)); }
public IEnumerable <BookDto> GetMostItemBooks(string field, int num = 5) { var sql = String.Format("SELECT Top {0} * FROM Book ORDER BY {1} DESC", num, field); var results = _bookRepository.ExecuteQuery(sql); return(QsMapper.CreateMapIEnume <Book, BookDto>(results)); }
public IEnumerable <BookDto> GetHighGradeBooks(int num = 3) { var sql = String.Format("SELECT Top {0} * FROM Book ORDER BY Grade DESC", num); var results = _bookRepository.ExecuteQuery(sql); return(QsMapper.CreateMapIEnume <Book, BookDto>(results)); }
public ActionResult Index(int id = 1) { var cache = _newsService.GetAllNews(); var temp = QsMapper.CreateMapIEnume <NewsDto, NewsViewModel>(cache); var model = temp.ToPagedList(id, 8); return(View(model)); }
public ActionResult Index(int id = 1) { var cache = _articleService.GetAllArticles(); var temp = QsMapper.CreateMapIEnume <ArticleDto, ArticleViewModel>(cache); var model = temp.ToPagedList(id, 10); return(View(model)); }
public ActionResult _Personal() { var user = CustomAuthorizeAttribute.GetUser(); BindSelectListDataSource((int)user.Gender); var result = _userService.GetUserById(user.UserId); return(PartialView(QsMapper.CreateMap <UserDto, AcntWithoutPsw>(result))); }
public IEnumerable <VideoDto> GetVideosWithCategory(string category, out int count, bool new2Old = true) { var result = _videoRepository.GetFiltered(v => v.Category.Contains(category), out count); if (new2Old) { result = result.OrderByDescending(v => v.CreateTime); } return(QsMapper.CreateMapIEnume <Video, VideoDto>(result)); }
public IEnumerable <ReservationDto> GetAllReservations() { var temp = _repository.GetAllWithOrder(filter => filter.Createtime); if (temp == null) { return(null); } return(QsMapper.CreateMapIEnume <Reservation, ReservationDto>(temp)); }
public IEnumerable <ReservationDto> GetReservationsWithState(int state) { var temp = _repository.GetFiltered(ft => ft.State == state); if (temp == null) { return(null); } return(QsMapper.CreateMapIEnume <Reservation, ReservationDto>(temp)); }
public IEnumerable <NewsDto> GetMostPopular(int number, bool onView = true) { if (number <= 0) { number = 3; } var results = _newsRepository.GetPaged(0, number, art => art.ViewTimes, false); return(QsMapper.CreateMapIEnume <News, NewsDto>(results)); }
public IEnumerable <NewsDto> GetItemWithKeyword(string keyword) { if (String.IsNullOrEmpty(keyword)) { return(null); } var newsEnumrable = _newsRepository.GetFiltered(it => it.NewsTitle.Contains(keyword)); return(QsMapper.CreateMapIEnume <News, NewsDto>(newsEnumrable)); }
public UserDto GetUserFindPassword(string realName, string email) { if (string.IsNullOrEmpty(realName) || string.IsNullOrEmpty(email)) { return(null); } var user = _userRepository.FirstOrDefault(m => m.RealName.Equals(realName) && m.Email.Equals(email)); return(QsMapper.CreateMap <User, UserDto>(user)); }
public UserDto GetUserByStuNumber(string stuNumber) { if (String.IsNullOrWhiteSpace(stuNumber)) { throw new ArgumentNullException(Message.warning_InvalidArgumentForFindUsers); } var currentUser = _userRepository.FirstOrDefault(e => e.StuNumber.Equals(stuNumber)); return(currentUser == null ? null : QsMapper.CreateMap <User, UserDto>(currentUser)); }
public IEnumerable <VideoCommentDto> GetSecondsVideoComments(int number) { if (number <= 0) { number = 3; } var results = _videoRepository.GetPaged(0, number, com => com.CreateTime, false); return(QsMapper.CreateMapIEnume <VideoComment, VideoCommentDto>(results)); }
public ActionResult Preregistration(ReserveModel model) { if (ModelState.IsValid) { _reservationService.AddReservation(QsMapper.CreateMap <ReserveModel, ReservationDto>(model)); TempData["Message"] = "您的预约信息已成功提交,索子会在2到3个工作日内处理,接下来将电话邀约核实,期间请保持通讯工具畅通"; return(RedirectToAction("Preregistration")); } return(View(model)); }
public IEnumerable <ArticleDto> GetItemWithKeyword(string keyword) { if (String.IsNullOrEmpty(keyword)) { return(null); } //var articleEnumrable = _articleRepository.GetFiltered(it => it.ArticleTitle.Contains(keyword) || it.ArticleContent.Contains(keyword)); var articleEnumrable = _articleRepository.GetFiltered(it => it.ArticleTitle.Contains(keyword)); return(QsMapper.CreateMapIEnume <Article, ArticleDto>(articleEnumrable)); }
public IEnumerable <TagDto> GetTagPaged(int pageIndex, int pageCount, out int count) { if (pageIndex <= 0 || pageCount <= 0) { count = 0; return(null); } var tagEnumrable = _tagRepository.GetPaged(pageIndex, pageCount, out count, n => n.TagSum, false); //var tagEnumrable = _tagRepository.GetPaged<Boolean, DateTime>(pageIndex, pageCount, n => n.IsTop, n => n.CreateTime, false, out count); return(QsMapper.CreateMapIEnume <Core.Module.Tag, TagDto>(tagEnumrable)); }
public IEnumerable <LoginLogDto> GetLoginLogPaged(int pageIndex, int pageCount, out int count) { if (pageCount <= 0 || pageIndex <= 0) { count = 0; return(null); } var loginLogEnumrable = _loginLogRepository.GetPaged(pageIndex, pageCount, out count, p => p.LoginTime, false); return(QsMapper.CreateMapIEnume <LoginLog, LoginLogDto>(loginLogEnumrable)); }