Пример #1
0
        public IActionResult Get([FromQuery] string name)
        {
            IEnumerable <Classroom> result;

            if (!string.IsNullOrWhiteSpace(name))
            {
                result = _classroomRepository.Find(name);
            }
            else
            {
                result = _classroomRepository.Fetch();
            }
            var results = Mapper.Map <IEnumerable <ClassroomModel> >(result);

            return(new ObjectResult(results));
        }
Пример #2
0
        public IActionResult GetAllObjectsCount()
        {
            var result1 = _schoolRepository.Fetch();
            var result2 = _classroomRepository.Fetch();
            var result3 = _activityRepository.Fetch();

            //var results = Mapper.Map<IEnumerable<SchoolModel>>(result);
            return(new ObjectResult(new
            {
                schoolCount = result1.Count(),
                classroomCount = result2.Count(),
                activityCount = result3.Count()
            }
                                    ));
        }
Пример #3
0
 public IActionResult Index()
 {
     return(View(Mapper.Map <IEnumerable <ClassroomModel> >(_repo.Fetch())));
 }