public IActionResult Get() { var list = houseRepository.GetAll(); var result = mapper.Map <List <House>, List <HouseDto> >(list); return(Ok(list)); }
public async Task <IActionResult> GetAll() { var lstHouse = await _houseRepository.GetAll(); ViewBag.LstHouse = await ConvertAllHouseToList(lstHouse); return(View()); }
public IActionResult GetAllHouses() { var allHouseEntitys = _houseRepository.GetAll().ToList(); var allHouseEntitysDto = allHouseEntitys.Select(x => Mapper.Map <HouseDto>(x)); Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(new { totalCount = _houseRepository.Count() })); return(Ok(allHouseEntitysDto)); }
public IActionResult Get() { try { return(Ok(_houseRepository.GetAll().Select(x => _houseMapper.MapToDto(x)))); } catch (Exception exception) { //logg exception or do anything with it return(StatusCode((int)HttpStatusCode.InternalServerError)); } }
public IActionResult GetAll() { var houses = _houseRepository.GetAll(); var claimsIdentity = this.User.Identity as ClaimsIdentity; var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; bool succes = Int32.TryParse(userId, out var ownerId); if (succes) { return(Ok(houses.Where(h => h.OwnerId == ownerId))); } return(Ok(houses)); }
public async Task <IHttpActionResult> Get(int page = 1, int pageSize = MaxPageSize) { if (pageSize > MaxPageSize) { pageSize = MaxPageSize; } var paginationHeader = new { totalCount = _houseRepository.GetAll().Count // Add more headers here if you want... // Link to next and previous page etc. // Also see OData-Options for this }; List <HouseEntity> result = _houseRepository.GetAll() .Skip(pageSize * (page - 1)) .Take(pageSize) .ToList(); HttpContext.Current.Response.AppendHeader("X-Pagination", JsonConvert.SerializeObject(paginationHeader)); return(Ok(result.Select(x => _houseMapper.MapToDto(x)))); }
public HouseQuery(IHouseRepository houseRepository) { Field <HouseType>("house", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id" }), resolve: context => houseRepository.GetById(context.GetArgument <int>("id")) ); Field <ListGraphType <HouseType> >("houses", resolve: context => houseRepository.GetAll()); }
public IEnumerable <House> GetAllHouses() { return(m_houseRepository.GetAll()); }
public IActionResult Get() { return(Ok(_houseRepository.GetAll().Select(x => _houseMapper.MapToDto(x)))); }
public IActionResult Create() { ViewBag.Houses = houseRepository.GetAll(); return(View()); }
public async Task <IEnumerable <HouseModel> > GetHouses() { var houses = await _houseRepository.GetAll(); return(houses.OrderBy(h => h.Name).Select(BusinessMapper.Map <HouseModel>)); }
public async Task <ICollection <House> > GetAll() { return(await _houses.GetAll()); }
public ActionResult <IEnumerable <House> > Get() { var types = repository.GetAll(); return(types); }
public IEnumerable <Stat> GetTopTenWithGarden() => GetTopTen(_repository .GetAll() .Where(h => h.HadGarden));
public IHttpActionResult Get() { List <HouseEntity> result = houseRepository.GetAll(); return(Ok(result.Select(x => houseMapper.MapToDto(x)))); }
public IEnumerable <CageModel> GetAll() { return(_houseRepository.GetAll().Select(x => new CageModel())); }