public void SaveEntityType(EntityTypeDTO entityTypeToSave) { if(entityTypeToSave!=null) { if (entityTypeToSave.EntityId > 0) { if (string.IsNullOrEmpty(entityTypeToSave.EntityTypeValue)) throw new FaultException<EntityLookupServiceFault>(new EntityLookupServiceFault("EntityType value is required"), "Validation Failed"); else { try { EntityTypeManager.Save(entityTypeToSave.EntityId, HydrateEntityType(entityTypeToSave)); } catch (BLLException ex) { throw new FaultException<EntityLookupServiceFault>(new EntityLookupServiceFault(ex.Message), "Save Failed"); } } } else throw new FaultException<EntityLookupServiceFault>(new EntityLookupServiceFault("Entity Id is required."), "Validation Failed"); } else throw new FaultException<EntityLookupServiceFault>(new EntityLookupServiceFault("EntityType object was invalid."), "Validation Failed"); }
private EntityType HydrateEntityType(EntityTypeDTO entityTypeDTO) { EntityType tempItem = new EntityType(); if(entityTypeDTO != null) { tempItem.EntityTypeId = entityTypeDTO.EntityTypeId; if (!string.IsNullOrEmpty(entityTypeDTO.EntityTypeValue)) tempItem.EntityTypeValue = entityTypeDTO.EntityTypeValue; } return tempItem; }
private EntityTypeDTO HydrateEntityTypeDTO(EntityType entityType) { EntityTypeDTO tempItem = new EntityTypeDTO(); if(entityType != null) { tempItem.EntityTypeId = entityType.EntityTypeId; if (!string.IsNullOrEmpty(entityType.EntityTypeValue)) tempItem.EntityTypeValue = entityType.EntityTypeValue; } return tempItem; }