Exemplo n.º 1
0
        public async Task <IActionResult> GetTransportPricingById(int transportPricingId)
        {
            try
            {
                var _serviceEndPoint      = new ServicesEndPoint(_unitOfWork, _emailService);
                TransportPricing tpresult = await _serviceEndPoint.GetTransportPricingById(transportPricingId);

                TransportPricingViewModel result = _Mapper.Map <TransportPricingViewModel>(tpresult);
                if (result == null)
                {
                    return(NotFound(result));
                }
                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteTransportPricing([FromBody] TransportPricingViewModel transportPricingViewModel)
        {
            try
            {
                var  _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService);
                var  transportPricing = _Mapper.Map <TransportPricing>(transportPricingViewModel);
                bool result           = await _serviceEndPoint.DeleteTransportPricing(transportPricing);

                if (!result)
                {
                    return(NotFound(transportPricingViewModel));
                }
                return(Ok(new { message = "Succesfully Deleted!", result = result }));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }