public ComponentType UpdateComponentType(Guid accountId, UpdateComponentTypeData data) { var type = GetById(accountId, data.Id.Value); if (type.IsSystem) { throw new CantUpdateSystemObjectException(); } if (string.IsNullOrEmpty(data.DisplayName) == false) { type.DisplayName = data.DisplayName; } if (string.IsNullOrEmpty(data.SystemName) == false) { type.SystemName = data.SystemName; } var accountdbContext = Context.GetAccountDbContext(accountId); accountdbContext.SaveChanges(); return(type); }
public static UpdateComponentTypeRequestDtoData GetUpdateComponentTypeRequestDtoData(UpdateComponentTypeData data) { if (data == null) { return(null); } return(new UpdateComponentTypeRequestDtoData() { SystemName = data.SystemName, DisplayName = data.DisplayName, Id = data.Id }); }