Ejemplo n.º 1
0
        public int AddVehicleType(VehicleTypeDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(VehicleTypeDTO.FormatVehicleTypeDTO(dto));

                R_VehicleType t = VehicleTypeDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddVehicleType(t);
                dto.VehicleTypeId = id;

                log.Debug("result: 'success', id: " + id);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }

            return(id);
        }
Ejemplo n.º 2
0
        public void DeleteVehicleType(VehicleTypeDTO dto)
        {
            try
            {
                log.Debug(VehicleTypeDTO.FormatVehicleTypeDTO(dto));

                R_VehicleType t = VehicleTypeDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteVehicleType(t);
                dto.IsDeleted = t.IsDeleted;

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Ejemplo n.º 3
0
        public void UpdateVehicleType(VehicleTypeDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "VehicleTypeId");

                log.Debug(VehicleTypeDTO.FormatVehicleTypeDTO(dto));

                R_VehicleType t = VehicleTypeDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateVehicleType(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }