public async Task <IActionResult> GetAllHouses(string world, string houseID) { var response = new Response <HouseDTO> { Succeed = false }; if (string.IsNullOrEmpty(world)) { response.Message = "The world name must be provided"; return(BadRequest(response)); } if (string.IsNullOrEmpty(houseID)) { response.Message = "The house id must be provided"; return(BadRequest(response)); } try { var r = await _houseService.GetHouse(world, houseID); response.Result = _mapper.Map <HouseDTO>(r.Response); response.Succeed = true; } catch (Exception ex) { response.Message = ex.Message; return(StatusCode(StatusCodes.Status500InternalServerError, response)); } return(Ok(response)); }
public ActionResult <House> GetHouse(string houseName) { var house = _houseService.GetHouse(houseName); if (house == null) { return(NotFound()); } return(Ok(house)); }
public IActionResult GetHouse(int houseId) { try { return(Ok(_houseService.GetHouse(houseId))); } catch (Exception) { return(NotFound()); } }
public IActionResult GetHouse(int houseId) { //get current user var currentUserId = _userManager.GetUserId(HttpContext.User); HouseMate currentUser = _houseMateService.GetHouseMate(currentUserId); if (houseId != currentUser.HouseId) { return(BadRequest("Housemate's houseId does not match")); } House house = _houseService.GetHouse(houseId); return(Ok(house)); }
public House GetHouse(long houseId) { return(_houseService.GetHouse(houseId)); }
public async Task <HouseViewModel> GetHouse(int id) { var house = await _houseService.GetHouse(id); return(house); }