コード例 #1
0
        public IActionResult Index()
        {
            IEnumerable <Student> students = _respository.GetAll();
            var vms = students.Select(s =>
                                      new StudentViewModel()
            {
                FullName = $"{s.FirstName}{s.LastName}",    //s.FirstName + s.LastName,
                Id       = s.Id,
                Age      = DateTime.Now.Subtract(s.Birthday).Days / 365,
                gender   = s.gender
            }
                                      );
            var vm = new HomeIndexModel()
            {
                Students = vms
            };

            return(View(vm));
        }
コード例 #2
0
        public async Task <BaseResponse> GetAll()
        {
            var Movies = await _respository.GetAll();

            if (Movies == null)
            {
                return(new BaseResponse
                {
                    ErrorCode = 1,
                    Messege = _errorHandler.GetMessage(ErrorMessagesEnum.ListEntityEmpty)
                });
            }
            return(new BaseResponse
            {
                ErrorCode = 0,
                Messege = _errorHandler.GetMessage(ErrorMessagesEnum.LoadSuccess),
                Data = Movies
            });
        }
コード例 #3
0
        // [Route("Movies/Index")]
        public IActionResult Index()
        {
            var movies = _movieRespository.GetAll();

            return(View(movies));
        }
コード例 #4
0
 /// <summary>
 /// 寻找所有
 /// </summary>
 /// <param name="useWhere">使用的过滤条件</param>
 /// <returns></returns>
 public List <X> GetAll(Expression <Func <X, bool> > useWhere = null, IncludeDel <X> useInclude = null)
 {
     return(m_coreRepository.GetAll(useWhere, useInclude));
 }