public IActionResult Get() { try { List <TouristSpot> allTouristSpots = touristSpotManagement.GetAllTouristSpot(); return(Ok(TouristSpotForResponseModel.ToModel(allTouristSpots))); } catch (ClientBusinessLogicException e) { return(NotFound(e.Message)); } catch (ServerBusinessLogicException e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public IActionResult Get(Guid id) { try { TouristSpot touristSpot = touristSpotManagement.GetTouristSpotById(id); return(Ok(TouristSpotForResponseModel.ToModel(touristSpot))); } catch (ClientBusinessLogicException e) { return(NotFound(e.Message)); } catch (ServerBusinessLogicException e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public IActionResult GetTouristSpotsByCategoriesAndRegionId([FromQuery] Guid[] categoriesId, [FromQuery] Guid regionId) { try { List <TouristSpot> touristSpotsByRegionAndCategories = touristSpotManagement. GetTouristSpotsByCategoriesAndRegion(categoriesId.ToList(), regionId); return(Ok(TouristSpotForResponseModel.ToModel(touristSpotsByRegionAndCategories))); } catch (ClientBusinessLogicException e) { return(NotFound(e.Message)); } catch (ServerBusinessLogicException e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public IActionResult Post([FromBody] TouristSpotForRequestModel aTouristSpot) { try { TouristSpot touristSpotAdded = touristSpotManagement.Create(TouristSpotForRequestModel.ToEntity(aTouristSpot), aTouristSpot.RegionId, aTouristSpot.ListOfCategoriesId); return(CreatedAtRoute("touristSpot", new { id = touristSpotAdded.Id }, TouristSpotForResponseModel.ToModel(touristSpotAdded))); } catch (DomainBusinessLogicException e) { return(BadRequest(e.Message)); } catch (ClientBusinessLogicException e) { return(NotFound(e.Message)); } catch (ServerBusinessLogicException e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }