Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        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));
            }
        }