public int AddVehicle(VehicleDTO dto) { int id = 0; try { log.Debug(VehicleDTO.FormatVehicleDTO(dto)); R_Vehicle t = VehicleDTO.ConvertDTOtoEntity(dto); // add id = Repository.AddVehicle(t); dto.VehicleId = id; log.Debug("result: 'success', id: " + id); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } return(id); }
public void DeleteVehicle(VehicleDTO dto) { try { log.Debug(VehicleDTO.FormatVehicleDTO(dto)); R_Vehicle t = VehicleDTO.ConvertDTOtoEntity(dto); // delete Repository.DeleteVehicle(t); dto.IsDeleted = t.IsDeleted; log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public void UpdateVehicle(VehicleDTO dto) { try { //Requires.NotNull(t); //Requires.PropertyNotNegative(t, "VehicleId"); log.Debug(VehicleDTO.FormatVehicleDTO(dto)); R_Vehicle t = VehicleDTO.ConvertDTOtoEntity(dto); // update Repository.UpdateVehicle(t); log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }