Esempio n. 1
0
        public async Task <IActionResult> DeleteFoodHubStorage([FromBody] FoodHubViewModel foodHubViewModel)
        {
            try
            {
                var            _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService);
                FoodHubStorage foodHubStorage   = _Mapper.Map <FoodHubStorage>(foodHubViewModel);
                bool           result           = await _serviceEndPoint.DeleteFoodHubStorage(foodHubStorage);

                if (!result)
                {
                    return(NotFound(foodHubViewModel));
                }
                return(Ok(new { message = "Succesfully Deleted!", result = result }));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> GetFoodHubStorageById(int foodHubStorageId)
        {
            try
            {
                var            _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService);
                FoodHubStorage result           = await _serviceEndPoint.GetFoodHubStorageById(foodHubStorageId);

                FoodHubStorageViewModel resultVmodel = _Mapper.Map <FoodHubStorageViewModel>(result);
                if (result == null)
                {
                    return(NotFound(result));
                }
                return(Ok(resultVmodel));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }