Exemplo n.º 1
0
        public async Task <IActionResult> DeleteCapacity([FromBody] VehicleCapacityViewModel vehicleViewModel)
        {
            try
            {
                var             _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService);
                VehicleCapacity vehicleCapacity  = _Mapper.Map <VehicleCapacity>(vehicleViewModel);
                bool            result           = await _serviceEndPoint.DeleteVehicleCapacity(vehicleCapacity);

                if (!result)
                {
                    return(NotFound(vehicleViewModel));
                }
                return(Ok(new { message = "Succesfully Deleted!", result = result }));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetVehicleCapacityById(int vehicleCapacityId)
        {
            try
            {
                var             _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService);
                VehicleCapacity tpresult         = await _serviceEndPoint.GetVehicleCapacityById(vehicleCapacityId);

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