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)); }
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 }); }
// [Route("Movies/Index")] public IActionResult Index() { var movies = _movieRespository.GetAll(); return(View(movies)); }
/// <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)); }