public void GenerationThroughProperties() { var o1 = new PropertiesDto(); var value = _faker.Create <PropertiesDto>(); Assert.AreNotEqual(01, value); }
public HttpResponseMessage EditProperty(int Id, PropertiesDto property) { var repository = new PropertiesRepository(); var result = repository.Edit(Id, property); if (result) { return(Request.CreateResponse(HttpStatusCode.OK)); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Property could not be updated")); }
public HttpResponseMessage AddNewProperty(PropertiesDto property) { var repository = new PropertiesRepository(); var result = repository.Create(property); if (result) { return(Request.CreateResponse(HttpStatusCode.Created)); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Property could not be added")); }
public bool Edit(int id, PropertiesDto property) { //property.PropertyId = id; using (var db = GetConnection()) { db.Open(); var edited = db.Execute(@"Update [dbo].[Property] SET [Name] = @PropertyName ,[AssociationCode] = @AssociationCode ,[TaxId] = @TaxId ,[ManagerId] = @ManagerId ,[Address] = @Address ,[City] = @City ,[PropertyType] = @PropertyType ,[NumberOfBuildings] = @NumberOfBuildings ,[NumberOfUnits] = @NumberOfUnits ,[GateAccessCode] = @GateAccessCode ,[FireAlarmPassword] = @FireAlarmPassword ,[ElectricalRoomCode] = @ElectricalRoomCode ,[LockboxCode] = @LockboxCode ,[CallboxCode] = @CallboxCode ,[PackageRoomCode] = @PackageRoomCode ,[ElevatorRoomCode] = @ElevatorRoomCode ,[PoolRoomCode] = @PoolRoomCode ,[PumpRoomCode] = @PumpRoomCode ,[OnSiteContact] = @OnSiteContact ,[WaterShutOffLocation] = @WaterShutOffLocation ,[RoofType] = @RoofType ,[ParkingPolicy] = @ParkingPolicy ,[RoofAccessCode] = @RoofAccessCode ,[FireAlarmVendorId] = @FireAlarmVendorId ,[InsuranceVendorId] = @InsuranceVendorId ,[ElevatorVendorId] = @ElevatorVendorId ,[PlumbingVendorId] = @PlumbingVendorId ,[ElectricalVendorId] = @ElectricalVendorId ,[GateVendorId] = @GateVendorId ,[TowingVendorId] = @TowingVendorId ,[EmergencyRemediationVendorId] = @EmergencyRemediationVendorId ,[ElectricUtilityCompanyId] = @ElectricUtilityCompanyId ,[WaterUtilityCompanyId] = @WaterUtilityCompanyId ,[AdditionalNotes] = @AdditionalNotes ,[LandscapingVendorId] = @LandscapingVendorId WHERE [Id] = @Id", new { property.PropertyName, property.AssociationCode, property.TaxId, property.ManagerId, property.Address, property.City, property.PropertyType, property.NumberOfBuildings, property.NumberOfUnits, property.GateAccessCode, property.FireAlarmPassword, property.ElectricalRoomCode, property.LockboxCode, property.CallboxCode, property.PackageRoomCode, property.ElevatorRoomCode, property.PoolRoomCode, property.PumpRoomCode, property.OnSiteContact, property.WaterShutOffLocation, property.RoofType, property.ParkingPolicy, property.RoofAccessCode, property.FireAlarmVendorId, property.InsuranceVendorId, property.ElevatorVendorId, property.PlumbingVendorId, property.ElectricalVendorId, property.GateVendorId, property.TowingVendorId, property.EmergencyRemediationVendorId, property.ElectricUtilityCompanyId, property.WaterUtilityCompanyId, property.AdditionalNotes, property.LandscapingVendorId, id }); return(edited == 1); } }
public bool Create(PropertiesDto property) { using (var db = GetConnection()) { db.Open(); var records = db.Execute(@"INSERT INTO [dbo].[Property] ([Name] ,[AssociationCode] ,[TaxId] ,[ManagerId] ,[Address] ,[City] ,[PropertyType] ,[NumberOfBuildings] ,[NumberOfUnits] ,[GateAccessCode] ,[FireAlarmPassword] ,[ElectricalRoomCode] ,[LockboxCode] ,[CallboxCode] ,[PackageRoomCode] ,[ElevatorRoomCode] ,[PoolRoomCode] ,[PumpRoomCode] ,[OnSiteContact] ,[WaterShutOffLocation] ,[RoofType] ,[ParkingPolicy] ,[RoofAccessCode] ,[FireAlarmVendorId] ,[InsuranceVendorId] ,[ElevatorVendorId] ,[PlumbingVendorId] ,[ElectricalVendorId] ,[GateVendorId] ,[TowingVendorId] ,[EmergencyRemediationVendorId] ,[ElectricUtilityCompanyId] ,[WaterUtilityCompanyId] ,[AdditionalNotes] ,[LandscapingVendorId]) VALUES (@Name ,@AssociationCode ,@TaxId ,@ManagerId ,@Address ,@City ,@PropertyType ,@NumberOfBuildings ,@NumberOfUnits ,@GateAccessCode ,@FireAlarmPassword ,@ElectricalRoomCode ,@LockboxCode ,@CallboxCode ,@PackageRoomCode ,@ElevatorRoomCode ,@PoolRoomCode ,@PumpRoomCode ,@OnSiteContact ,@WaterShutOffLocation ,@RoofType ,@ParkingPolicy ,@RoofAccessCode ,@FireAlarmVendorId ,@InsuranceVendorId ,@ElevatorVendorId ,@PlumbingVendorId ,@ElectricalVendorId ,@GateVendorId ,@TowingVendorId ,@EmergencyRemediationVendorId ,@ElectricUtilityCompanyId ,@WaterUtilityCompanyId ,@AdditionalNotes ,@LandscapingVendorId)", property); return(records == 1); } }