public async Task <IActionResult> GetFoodHubById(int foodHubId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); FoodHub result = await _serviceEndPoint.GetFoodHubById(foodHubId); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> UpdateFoodHub(FoodHub foodHubViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var foodHub = _Mapper.Map <FoodHub>(foodHubViewModel); bool result = await _serviceEndPoint.UpdateFoodHub(foodHub); if (!result) { return(NotFound(foodHub)); } return(Ok(new { message = "Succesfully Updated!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }