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